static void init_cursors( void ) { static int ok; CurStruct *c; static char c_bits[ ] = { 0x00 }; if ( ok ) return; ok = 1; if ( ! cursors ) { cursors = fl_calloc( MAX_CURSORS, sizeof *c ); memcpy( cursors, prebuilt, sizeof prebuilt ); } for ( c = cursors; c->name; c++ ) c->cur[ c->ncursor++ ] = XCreateFontCursor( flx->display, c->name ); /* Create an invisible cursor */ add_cursor( FL_INVISIBLE_CURSOR, create_bitmap_cursor( c_bits, c_bits, 1, 1, 0, 0 ) ); /* Add the default cursor */ add_cursor( FL_DEFAULT_CURSOR, XCreateFontCursor( flx->display, fl_default_curname ) ); }
void cdk_style_schemes_init (void) { if (style_name_map != NULL) return; style_name_map = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); token_map = g_hash_table_new (g_direct_hash, g_direct_equal); cursor_map = g_hash_table_new (g_direct_hash, g_direct_equal); // Map style scheme style names to CdkStyleIDs add_map ("default", CDK_STYLE_DEFAULT); add_map ("comment", CDK_STYLE_COMMENT); add_map ("member_ref", CDK_STYLE_MEMBER_REF); add_map ("identifier", CDK_STYLE_IDENTIFIER); add_map ("keyword", CDK_STYLE_KEYWORD); add_map ("literal", CDK_STYLE_LITERAL); add_map ("number", CDK_STYLE_NUMBER); add_map ("preprocessor", CDK_STYLE_PREPROCESSOR); add_map ("punctuation", CDK_STYLE_PUNCTUATION); add_map ("string", CDK_STYLE_STRING); add_map ("type_name", CDK_STYLE_TYPE_NAME); add_map ("function_call", CDK_STYLE_FUNCTION_CALL); add_map ("character", CDK_STYLE_CHARACTER); add_map ("diagnostic_warning", CDK_STYLE_DIAGNOSTIC_WARNING); add_map ("diagnostic_error", CDK_STYLE_DIAGNOSTIC_ERROR); add_map ("annotation_warning", CDK_STYLE_ANNOTATION_WARNING); add_map ("annotation_error", CDK_STYLE_ANNOTATION_ERROR); // Map libclang CXTokenKinds to CdkStyleIDs add_token (CXToken_Punctuation, CDK_STYLE_PUNCTUATION); add_token (CXToken_Keyword, CDK_STYLE_KEYWORD); add_token (CXToken_Identifier, CDK_STYLE_IDENTIFIER); add_token (CXToken_Literal, CDK_STYLE_LITERAL); add_token (CXToken_Comment, CDK_STYLE_COMMENT); // Map libclang CXCursorKinds (more specific) to CdkStyleIDs add_cursor (CXCursor_TypeRef, CDK_STYLE_TYPE_NAME); add_cursor (CXCursor_MemberRef, CDK_STYLE_MEMBER_REF); add_cursor (CXCursor_MemberRefExpr, CDK_STYLE_MEMBER_REF); add_cursor (CXCursor_CallExpr, CDK_STYLE_FUNCTION_CALL); add_cursor (CXCursor_StringLiteral, CDK_STYLE_STRING); add_cursor (CXCursor_CharacterLiteral, CDK_STYLE_CHARACTER); add_cursor (CXCursor_IntegerLiteral, CDK_STYLE_NUMBER); add_cursor (CXCursor_FloatingLiteral, CDK_STYLE_NUMBER); add_cursor (CXCursor_ImaginaryLiteral, CDK_STYLE_NUMBER); // ... }
int fl_create_animated_cursor( int * cur_names, int timeout ) { int *n = cur_names, k = MAX_SEQ; CurStruct *c = 0; for ( ; *n >= 0 && --k >= 0; n++ ) c = add_cursor( user_cur_name, fli_get_cursor_byname( *n ) ); if ( c ) c->timeout = timeout > 0 ? timeout : 20; return user_cur_name++; }
int fl_create_bitmap_cursor( const char * source, const char * mask, int w, int h, int hotx, int hoty ) { Cursor cur; init_cursors( ); cur = create_bitmap_cursor( source, mask, w, h, hotx, hoty ); add_cursor( user_cur_name, cur ); return user_cur_name++; }
Cursor fli_get_cursor_byname( int name ) { CurStruct *c; Cursor cur = 0; init_cursors( ); for ( c = cursors; c->name; c++ ) { if ( c->name == name ) { int n = c->cur_cursor % c->ncursor; c->cur_cursor++; return c->cur[ n ]; } } /* Take a wild shot: since we can generate the default X cursor on the fly we don't have to always save them to the cursor structure */ if ( name < XC_num_glyphs - 1 ) { static int nn; cur = XCreateFontCursor( flx->display, name ); if ( nn < 10 ) { add_cursor( name, cur ); nn++; } } else { M_err( "fli_get_cursor_byname", "Unknown cursor: %d\n", name ); cur = fli_get_cursor_byname( FL_DEFAULT_CURSOR ); /* recursion */ } return cur; }
//--------------------------------------------------------------------------------------- ImoObj* Linker::add_child_to_model(ImoObj* pParent, ImoObj* pChild, int ldpChildType) { //If the object (or its content, for DTOs) is added to the model it must return NULL. //Othewise, it must return the received object. This behaviour is necessary to //simplify unit tests of LdpAnalyser m_ldpChildType = ldpChildType; m_pParent = pParent; switch(pChild->get_obj_type()) { case k_imo_bezier_info: return add_bezier(static_cast<ImoBezierInfo*>(pChild)); case k_imo_content: return add_content(static_cast<ImoContent*>(pChild)); case k_imo_cursor_info: return add_cursor(static_cast<ImoCursorInfo*>(pChild)); case k_imo_font_style_dto: return add_font_style(static_cast<ImoFontStyleDto*>(pChild)); case k_imo_instrument: return add_instrument(static_cast<ImoInstrument*>(pChild)); case k_imo_instr_group: return add_instruments_group(static_cast<ImoInstrGroup*>(pChild)); case k_imo_listitem: return add_listitem(static_cast<ImoListItem*>(pChild)); case k_imo_midi_info: return add_midi_info(static_cast<ImoMidiInfo*>(pChild)); case k_imo_music_data: return add_child(k_imo_instrument, pChild); case k_imo_option: return add_option(static_cast<ImoOptionInfo*>(pChild)); case k_imo_page_info: return add_page_info(static_cast<ImoPageInfo*>(pChild)); case k_imo_param_info: return add_param_info(static_cast<ImoParamInfo*>(pChild)); case k_imo_score_text: return add_text(static_cast<ImoScoreText*>(pChild)); case k_imo_score_title: return add_title(static_cast<ImoScoreTitle*>(pChild)); case k_imo_staff_info: return add_staff_info(static_cast<ImoStaffInfo*>(pChild)); case k_imo_styles: return add_child(k_imo_document, pChild); case k_imo_system_info: return add_system_info(static_cast<ImoSystemInfo*>(pChild)); case k_imo_style: return add_style(static_cast<ImoStyle*>(pChild)); case k_imo_table_row: { if (m_pParent) { if (m_pParent->is_table_head()) return add_child(k_imo_table_head, pChild); else if (m_pParent->is_table_body()) return add_child(k_imo_table_body, pChild); else return pChild; } else return pChild; } case k_imo_table_head: case k_imo_table_body: { if (m_pParent && m_pParent->is_table()) return add_child(k_imo_table, pChild); else return pChild; } default: if (pChild->is_block_level_obj()) return add_block_level_item(static_cast<ImoBlockLevelObj*>(pChild)); else if (pChild->is_inline_level_obj()) return add_inline_level_item(static_cast<ImoInlineLevelObj*>(pChild)); else if (pChild->is_staffobj()) return add_staffobj(static_cast<ImoStaffObj*>(pChild)); else if (pChild->is_relobj()) return add_relation(static_cast<ImoRelObj*>(pChild)); else if (pChild->is_auxobj()) return add_attachment(static_cast<ImoAuxObj*>(pChild)); else return pChild; } }