void Pointfile_Construct() { CPointfile::constructStatic(); GlobalShaderCache().attachRenderable(s_pointfile); GlobalCommands_insert("TogglePointfile", FreeCaller<Pointfile_Toggle>()); GlobalCommands_insert("NextLeakSpot", FreeCaller<Pointfile_Next>(), Accelerator('K', (GdkModifierType)(GDK_SHIFT_MASK|GDK_CONTROL_MASK))); GlobalCommands_insert("PrevLeakSpot", FreeCaller<Pointfile_Prev>(), Accelerator('L', (GdkModifierType)(GDK_SHIFT_MASK|GDK_CONTROL_MASK))); }
void Entity_Construct() { GlobalCommands_insert("EntityColor", FreeCaller<Entity_setColour>(), Accelerator('K')); GlobalCommands_insert("ConnectSelection", FreeCaller<Entity_connectSelected>(), Accelerator('K', (GdkModifierType)GDK_CONTROL_MASK)); GlobalCommands_insert("UngroupSelection", FreeCaller<Entity_ungroupSelected>()); GlobalPreferenceSystem().registerPreference("SI_Colors5", Vector3ImportStringCaller(g_entity_globals.color_entity), Vector3ExportStringCaller(g_entity_globals.color_entity)); GlobalPreferenceSystem().registerPreference("LastLightIntensity", IntImportStringCaller(g_iLastLightIntensity), IntExportStringCaller(g_iLastLightIntensity)); Entity_registerPreferencesPage(); }
void Entity_Construct(){ GlobalCommands_insert( "EntityColor", makeCallbackF(Entity_setColour), Accelerator( 'K' ) ); GlobalCommands_insert( "NormalizeColor", makeCallbackF(Entity_normalizeColor) ); GlobalCommands_insert( "ConnectSelection", makeCallbackF(Entity_connectSelected), Accelerator( 'K', (GdkModifierType)GDK_CONTROL_MASK ) ); GlobalCommands_insert( "KillConnectSelection", makeCallbackF(Entity_killconnectSelected), Accelerator( 'K', (GdkModifierType)( GDK_SHIFT_MASK ) ) ); GlobalCommands_insert( "GroupSelection", makeCallbackF(Entity_groupSelected) ); GlobalCommands_insert( "UngroupSelection", makeCallbackF(Entity_ungroupSelected) ); GlobalPreferenceSystem().registerPreference( "SI_Colors5", make_property_string( g_entity_globals.color_entity ) ); GlobalPreferenceSystem().registerPreference( "LastLightIntensity", make_property_string( g_iLastLightIntensity ) ); Entity_registerPreferencesPage(); }
void NativeButton::SetIsDefault(bool is_default) { if(is_default == is_default_) { return; } if(is_default) { AddAccelerator(Accelerator(VKEY_RETURN, false, false, false)); } else { RemoveAccelerator(Accelerator(VKEY_RETURN, false, false, false)); } SetAppearsAsDefault(is_default); }
Accelerator accelerator_for_event_key( guint keyval, guint state ){ keyval = gdk_keyval_to_upper( keyval ); if ( keyval == GDK_KEY_ISO_Left_Tab ) { keyval = GDK_KEY_Tab; } return Accelerator( keyval, (GdkModifierType)( state & gtk_accelerator_get_default_mod_mask() ) ); }
void Entity_Construct(){ GlobalCommands_insert( "EntityColorSet", FreeCaller<Entity_setColour>(), Accelerator( 'K' ) ); GlobalCommands_insert( "EntityColorNormalize", FreeCaller<Entity_normalizeColor>() ); GlobalCommands_insert( "EntitiesConnect", FreeCaller<Entity_connectSelected>(), Accelerator( 'K', (GdkModifierType)GDK_CONTROL_MASK ) ); if ( g_pGameDescription->mGameType == "nexuiz" || g_pGameDescription->mGameType == "q1" ) GlobalCommands_insert( "EntitiesKillConnect", FreeCaller<Entity_killconnectSelected>(), Accelerator( 'K', (GdkModifierType)GDK_SHIFT_MASK ) ); GlobalCommands_insert( "EntityMovePrimitivesToLast", FreeCaller<Entity_moveSelectedPrimitivesToLast>(), Accelerator( 'M', (GdkModifierType)GDK_CONTROL_MASK ) ); GlobalCommands_insert( "EntityMovePrimitivesToFirst", FreeCaller<Entity_moveSelectedPrimitivesToFirst>() ); GlobalCommands_insert( "EntityUngroup", FreeCaller<Entity_ungroup>() ); GlobalCommands_insert( "EntityUngroupPrimitives", FreeCaller<Entity_ungroupSelectedPrimitives>() ); GlobalToggles_insert( "ShowLightRadiuses", FreeCaller<ToggleShowLightRadii>(), ToggleItem::AddCallbackCaller( g_show_lightradii_item ) ); GlobalPreferenceSystem().registerPreference( "SI_Colors5", Vector3ImportStringCaller( g_entity_globals.color_entity ), Vector3ExportStringCaller( g_entity_globals.color_entity ) ); GlobalPreferenceSystem().registerPreference( "LastLightIntensity", IntImportStringCaller( g_iLastLightIntensity ), IntExportStringCaller( g_iLastLightIntensity ) ); Entity_registerPreferencesPage(); }
bool NativeTextfieldWin::GetAcceleratorForCommandId(int command_id, ui::Accelerator* accelerator) { // The standard Ctrl-X, Ctrl-V and Ctrl-C are not defined as accelerators // anywhere so we need to check for them explicitly here. switch(command_id) { case IDS_APP_CUT: *accelerator = Accelerator(ui::VKEY_X, false, true, false); return true; case IDS_APP_COPY: *accelerator = Accelerator(ui::VKEY_C, false, true, false); return true; case IDS_APP_PASTE: *accelerator = Accelerator(ui::VKEY_V, false, true, false); return true; } return container_view_->GetWidget()->GetAccelerator(command_id, accelerator); }
bool Accelerator::isPressed(KeyModifiers modifiers, KeyScancode scancode, int unicodeChar) const { return ((scancode && *this == Accelerator(modifiers, scancode, 0)) || (unicodeChar && *this == Accelerator(modifiers, kKeyNil, unicodeChar))); }
bool Accelerator::isPressed(KeyModifiers modifiers, KeyScancode scancode, int unicodeChar) const { // Preprocess the character to be compared with the accelerator #ifdef PREPROCESS_KEYS // Directly scancode if ((scancode >= kKeyF1 && scancode <= kKeyF12) || (scancode == kKeyEsc) || (scancode == kKeyBackspace) || (scancode == kKeyTab) || (scancode == kKeyEnter) || (scancode == kKeyBackslash) || (scancode == kKeyBackslash2) || (scancode >= kKeySpace && scancode <= kKeyDown) || (scancode >= kKeyEnterPad && scancode <= kKeyNoconvert) || (scancode == kKeyKanji)) { unicodeChar = 0; } // For Ctrl+number /* scancode unicodeChar Ctrl+0 27 0 Ctrl+1 28 2 Ctrl+2 29 0 Ctrl+3 30 27 Ctrl+4 31 28 Ctrl+5 32 29 Ctrl+6 33 30 Ctrl+7 34 31 Ctrl+8 35 127 Ctrl+9 36 2 */ else if ((scancode >= kKey0 && scancode <= kKey9) && (unicodeChar < 32 || unicodeChar == 127)) { unicodeChar = '0' + scancode - kKey0; scancode = kKeyNil; } // For Ctrl+letter else if (unicodeChar >= 1 && unicodeChar <= 'z'-'a'+1) { unicodeChar = 'a'+unicodeChar-1; scancode = kKeyNil; } // For any other legal Unicode code else if (unicodeChar >= ' ') { unicodeChar = std::tolower(unicodeChar); /* without shift (because characters like '*' can be trigger with "Shift+8", so we don't want "Shift+*") */ if (!(unicodeChar >= 'a' && unicodeChar <= 'z')) modifiers = (KeyModifiers)((int)modifiers & ((int)~kKeyShiftModifier)); scancode = kKeyNil; } #endif #ifdef REPORT_KEYS printf("%3d==%3d %3d==%3d %s==%s ", m_scancode, scancode, m_unicodeChar, unicodeChar, toString().c_str(), Accelerator(modifiers, scancode, unicodeChar).toString().c_str()); #endif if ((m_modifiers == modifiers) && ((m_scancode != kKeyNil && m_scancode == scancode) || (m_unicodeChar && m_unicodeChar == unicodeChar) || (m_scancode == kKeyNil && scancode == kKeyNil && !m_unicodeChar && !unicodeChar))) { #ifdef REPORT_KEYS printf("true\n"); fflush(stdout); #endif return true; } #ifdef REPORT_KEYS printf("false\n"); fflush(stdout); #endif return false; }
void GroupDialog_Construct() { GlobalPreferenceSystem().registerPreference("EntityWnd", WindowPositionTrackerImportStringCaller(g_GroupDlg.m_position_tracker), WindowPositionTrackerExportStringCaller(g_GroupDlg.m_position_tracker)); GlobalCommands_insert("ViewEntityInfo", FreeCaller<GroupDialog_ToggleShow>(), Accelerator('N')); }
void DialogClientView::ShowDialogButtons() { DialogDelegate* dd = GetDialogDelegate(); int buttons = dd->GetDialogButtons(); if(buttons & ui::MessageBoxFlags::DIALOGBUTTON_OK && !ok_button_) { std::wstring label = dd->GetDialogButtonLabel( ui::MessageBoxFlags::DIALOGBUTTON_OK); if(label.empty()) { label = UTF16ToWide(ui::GetStringUTF16(IDS_APP_OK)); } bool is_default_button = (dd->GetDefaultDialogButton() & ui::MessageBoxFlags::DIALOGBUTTON_OK) != 0; ok_button_ = new DialogButton(this, GetWidget(), ui::MessageBoxFlags::DIALOGBUTTON_OK, label, is_default_button); ok_button_->SetGroup(kButtonGroup); if(is_default_button) { default_button_ = ok_button_; } if(!(buttons & ui::MessageBoxFlags::DIALOGBUTTON_CANCEL)) { ok_button_->AddAccelerator(Accelerator(ui::VKEY_ESCAPE, false, false, false)); } AddChildView(ok_button_); } if(buttons & ui::MessageBoxFlags::DIALOGBUTTON_CANCEL && !cancel_button_) { std::wstring label = dd->GetDialogButtonLabel( ui::MessageBoxFlags::DIALOGBUTTON_CANCEL); if(label.empty()) { if(buttons & ui::MessageBoxFlags::DIALOGBUTTON_OK) { label = UTF16ToWide(ui::GetStringUTF16(IDS_APP_CANCEL)); } else { label = UTF16ToWide(ui::GetStringUTF16(IDS_APP_CLOSE)); } } bool is_default_button = (dd->GetDefaultDialogButton() & ui::MessageBoxFlags::DIALOGBUTTON_CANCEL) != 0; cancel_button_ = new DialogButton(this, GetWidget(), ui::MessageBoxFlags::DIALOGBUTTON_CANCEL, label, is_default_button); cancel_button_->SetGroup(kButtonGroup); cancel_button_->AddAccelerator(Accelerator(ui::VKEY_ESCAPE, false, false, false)); if(is_default_button) { default_button_ = ok_button_; } AddChildView(cancel_button_); } if(!buttons) { // Register the escape key as an accelerator which will close the window // if there are no dialog buttons. AddAccelerator(Accelerator(ui::VKEY_ESCAPE, false, false, false)); } }
void Brush_registerCommands() { GlobalToggles_insert("TogTexLock", FreeCaller<Texdef_ToggleMoveLock>(), ToggleItem::AddCallbackCaller(g_texdef_movelock_item), Accelerator('T', (GdkModifierType)GDK_SHIFT_MASK)); GlobalCommands_insert("BrushPrism", BrushPrefab::SetCaller(g_brushprism)); GlobalCommands_insert("BrushCone", BrushPrefab::SetCaller(g_brushcone)); GlobalCommands_insert("BrushSphere", BrushPrefab::SetCaller(g_brushsphere)); GlobalCommands_insert("Brush3Sided", BrushMakeSided::SetCaller(g_brushmakesided3), Accelerator('3', (GdkModifierType)GDK_CONTROL_MASK)); GlobalCommands_insert("Brush4Sided", BrushMakeSided::SetCaller(g_brushmakesided4), Accelerator('4', (GdkModifierType)GDK_CONTROL_MASK)); GlobalCommands_insert("Brush5Sided", BrushMakeSided::SetCaller(g_brushmakesided5), Accelerator('5', (GdkModifierType)GDK_CONTROL_MASK)); GlobalCommands_insert("Brush6Sided", BrushMakeSided::SetCaller(g_brushmakesided6), Accelerator('6', (GdkModifierType)GDK_CONTROL_MASK)); GlobalCommands_insert("Brush7Sided", BrushMakeSided::SetCaller(g_brushmakesided7), Accelerator('7', (GdkModifierType)GDK_CONTROL_MASK)); GlobalCommands_insert("Brush8Sided", BrushMakeSided::SetCaller(g_brushmakesided8), Accelerator('8', (GdkModifierType)GDK_CONTROL_MASK)); GlobalCommands_insert("Brush9Sided", BrushMakeSided::SetCaller(g_brushmakesided9), Accelerator('9', (GdkModifierType)GDK_CONTROL_MASK)); GlobalCommands_insert("ClipSelected", FreeCaller<ClipSelected>(), Accelerator(GDK_Return)); GlobalCommands_insert("SplitSelected", FreeCaller<SplitSelected>(), Accelerator(GDK_Return, (GdkModifierType)GDK_SHIFT_MASK)); GlobalCommands_insert("FlipClip", FreeCaller<FlipClipper>(), Accelerator(GDK_Return, (GdkModifierType)GDK_CONTROL_MASK)); GlobalCommands_insert("FaceCopyTexture", FreeCaller<SelectedFaces_copyTexture>()); GlobalCommands_insert("FacePasteTexture", FreeCaller<SelectedFaces_pasteTexture>()); GlobalCommands_insert("MakeDetail", FreeCaller<Select_MakeDetail>(), Accelerator('M', (GdkModifierType)GDK_CONTROL_MASK)); GlobalCommands_insert("MakeStructural", FreeCaller<Select_MakeStructural>(), Accelerator('S', (GdkModifierType)(GDK_SHIFT_MASK|GDK_CONTROL_MASK))); }