From d102fb2d8deda4d09c0e3ce90721488fd78a2ad2 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Thu, 6 Oct 2011 15:59:48 +0000 Subject: moved [keyboard_layout] to the apple lib, since its Apple only svn path=/trunk/externals/hcs/; revision=15530 --- Makefile | 2 +- keyboard_layout-help.pd | 37 --------------- keyboard_layout.c | 116 ------------------------------------------------ 3 files changed, 1 insertion(+), 154 deletions(-) delete mode 100644 keyboard_layout-help.pd delete mode 100644 keyboard_layout.c diff --git a/Makefile b/Makefile index 908877f..61315d4 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ LIBRARY_NAME = hcs # add your .c source files, one object per file, to the SOURCES # variable, help files will be included automatically, and for GUI # objects, the matching .tcl file too -SOURCES = canvas_name.c ce_path.c classpath.c colorpanel.c cursor.c folder_list.c group.c helppath.c keyboard_layout.c passwd.c screensize.c setenv.c split_path.c sql_query.c stat.c sys_gui.c uname.c unsetenv.c version.c window_name.c +SOURCES = canvas_name.c ce_path.c classpath.c colorpanel.c cursor.c folder_list.c group.c helppath.c passwd.c screensize.c setenv.c split_path.c sql_query.c stat.c sys_gui.c uname.c unsetenv.c version.c window_name.c # For objects that only build on certain platforms, add those to the SOURCES # line for the right platforms. diff --git a/keyboard_layout-help.pd b/keyboard_layout-help.pd deleted file mode 100644 index 9b0a01c..0000000 --- a/keyboard_layout-help.pd +++ /dev/null @@ -1,37 +0,0 @@ -#N canvas 0 26 553 346 10; -#X msg 116 32 bang; -#X msg 144 63 menu; -#X obj 242 244 flatspace/popup 124 25 #ffffff _ option; -#X msg 141 209 options; -#X obj 203 163 route clear; -#X symbolatom 116 277 0 0 0 0 - - -; -#X text 183 64 see all options in the popup menu; -#X obj 308 111 symbol; -#X text 250 283 select a new input method with the popup menu; -#X obj 202 185 bang; -#X msg 197 208 name language; -#N canvas 231 99 494 344 META 0; -#X text 12 145 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan -Wilkes for Pd version 0.42.; -#X text 12 25 LICENSE GPL v3; -#X text 12 125 AUTHOR Hans-Christoph Steiner; -#X text 12 5 KEYWORDS control GUI needs_work (object won't create) -; -#X text 12 45 DESCRIPTION needs a description; -#X text 12 65 INLET_0 bang menu symbol; -#X text 12 85 OUTLET_0; -#X text 12 105 OUTLET_1; -#X restore 502 322 pd META; -#X obj 116 144 keyboard_layout; -#X connect 0 0 12 0; -#X connect 1 0 12 0; -#X connect 2 1 7 0; -#X connect 3 0 2 0; -#X connect 4 0 9 0; -#X connect 4 1 2 0; -#X connect 7 0 12 0; -#X connect 9 0 3 0; -#X connect 9 0 10 0; -#X connect 10 0 2 0; -#X connect 12 0 5 0; -#X connect 12 1 4 0; diff --git a/keyboard_layout.c b/keyboard_layout.c deleted file mode 100644 index b51168c..0000000 --- a/keyboard_layout.c +++ /dev/null @@ -1,116 +0,0 @@ -/* Copyright 2006 Fredrik Olofsson - * Copyright 2007 Free Software Foundation - * ported to Pd by Hans-Christoph Steiner from f0.keyboard_layout.c - */ - -#include "m_pd.h" -#ifdef __APPLE__ -#include -#endif - -static t_class *keyboard_layout_class; - -typedef struct _keyboard_layout { - t_object x_obj; - t_outlet* x_data_outlet; - t_outlet* x_status_outlet; -} t_keyboard_layout; - -#ifdef __APPLE__ - -//---------------------------------------------------------------------------------------------- -void keyboard_layout_bang(t_keyboard_layout *x) { - //OSStatus err; - KeyboardLayoutRef currentLayoutRef; - const void *keyboardName; - char cKeyboardName[100]; - - KLGetCurrentKeyboardLayout(¤tLayoutRef); - KLGetKeyboardLayoutProperty(currentLayoutRef, kKLName, (const void **)&keyboardName); - CFStringGetCString((CFStringRef)keyboardName, cKeyboardName, 100, kCFStringEncodingASCII); - - outlet_symbol(x->x_data_outlet, gensym(cKeyboardName)); -} - -void keyboard_layout_menu(t_keyboard_layout *x) { - //OSStatus err; - KeyboardLayoutRef currentLayoutRef; - const void *keyboardName; - char cKeyboardName[100]; - CFIndex countOfLayouts; - CFIndex i; - t_atom name; - -// TODO this should probably output [menu clear( so other messages work too - outlet_anything(x->x_status_outlet, gensym("clear"), 0, NULL); - - KLGetKeyboardLayoutCount(&countOfLayouts); - for(i= 0; ix_status_outlet, gensym("append"), 1, &name); - } -} - -void keyboard_layout_anything(t_keyboard_layout *x, t_symbol *s, short argc, t_atom *argv) { - //OSStatus err; - KeyboardLayoutRef currentLayoutRef; - const void *keyboardName; - char cKeyboardName[100]; - - keyboardName= CFStringCreateWithCString(NULL, s->s_name, kCFStringEncodingASCII); - KLGetKeyboardLayoutWithName(keyboardName, ¤tLayoutRef); - KLGetKeyboardLayoutProperty(currentLayoutRef, kKLName, (const void **)&keyboardName); - CFStringGetCString((CFStringRef)keyboardName, cKeyboardName, 100, kCFStringEncodingASCII); - KLSetCurrentKeyboardLayout(currentLayoutRef); - //outlet_anything(x->t_out, s, 0, NULL); - keyboard_layout_bang(x); -} - -void *keyboard_layout_new(void) { - t_keyboard_layout *x = (t_keyboard_layout *)pd_new(keyboard_layout_class); - - x->x_data_outlet = outlet_new(&x->x_obj, &s_float); - x->x_status_outlet = outlet_new(&x->x_obj, &s_symbol); - - return (x); -} - -//---------------------------------------------------------------------------------------------- -void keyboard_layout_setup(void) { - keyboard_layout_class = class_new(gensym("keyboard_layout"), - (t_newmethod)keyboard_layout_new, - NULL, - sizeof(t_keyboard_layout), - 0, A_GIMME, 0); - - class_addbang(keyboard_layout_class, (t_method)keyboard_layout_bang); - class_addanything(keyboard_layout_class, (t_method)keyboard_layout_anything); - - class_addmethod(keyboard_layout_class, (t_method)keyboard_layout_menu, - gensym("menu"), 0); - - post("f0.keyboard_layout v1.1-ub; distributed under GNU GPL license"); -} - - -#else /* GNU/Linux and Windows */ - - -void keyboard_layout_new(void) -{ - post("f0.keyboard_layout v1.1-ub; distributed under GNU GPL license"); - post("ERROR: this objectclass is currently only for Mac OS X"); -} - -void keyboard_layout_setup(void) -{ - keyboard_layout_class = class_new(gensym("text"), (t_method)keyboard_layout_new, - NULL, sizeof(t_keyboard_layout), 0, 0); -} - -#endif /* __APPLE__ */ -- cgit v1.2.1