void AudioView::Copy() { ClearClipboard(); TrackList *tracks = GetTracks(); VTrack *n = tracks->First(); VTrack *dest = 0; while(n) { if (n->selected) { n->Copy(sel0, sel1, &dest); if (dest) clipboard->Add(dest); } n = tracks->Next(); } clipLen = (sel1 - sel0); sel1 = sel0; UpdateMenus(); // PushState(); // Not an undoable operation }
void Display::Close() { std::list<Window*>::iterator win; OS::Base::Display::Close(); if (selectObject!=NULL) { CancelSelection(); } ClearClipboard(); //d.selector.Close; win=winList.begin(); while (win!=winList.end()) { std::cerr << "Warning: window '" << Lum::Base::WStringToString((*win)->GetTitle()) << "' not explicitely closed" << std::endl; (*win)->Close(); // removes itself from list win=winList.begin(); } delwin(screen); endwin(); delete eventLoop; }
void AudacityProject::Cut(wxCommandEvent & event) { ClearClipboard(); TrackListIterator iter(mTracks); VTrack *n = iter.First(); VTrack *dest = 0; while (n) { if (n->GetSelected()) { n->Cut(mViewInfo.sel0, mViewInfo.sel1, &dest); if (dest) msClipboard->Add(dest); } n = iter.Next(); } msClipLen = (mViewInfo.sel1 - mViewInfo.sel0); msClipProject = this; mViewInfo.sel1 = mViewInfo.sel0; PushState(_("Cut to the clipboard")); FixScrollbars(); mTrackPanel->Refresh(false); }
// Dtor ctConfigToolDoc::~ctConfigToolDoc() { DeleteItems(); ClearClipboard(); if (GetCommandProcessor()) GetCommandProcessor()->SetEditMenu(NULL); }
void AudioView::Cut() { ClearClipboard(); TrackList *tracks = GetTracks(); VTrack *n = tracks->First(); VTrack *dest = 0; while(n) { if (n->selected) { n->Cut(sel0, sel1, &dest); if (dest) clipboard->Add(dest); } n = tracks->Next(); } clipLen = (sel1 - sel0); sel1 = sel0; PushState(); FixScrollbars(); REDRAW(trackPanel); REDRAW(rulerPanel); UpdateMenus(); }
void ShowQTF(const String& qtf, const char *title) { RichText txt = ParseQTF(qtf); ClearClipboard(); AppendClipboard(ParseQTF(qtf)); WithStatLayout<TopWindow> dlg; CtrlLayoutOK(dlg, title); dlg.stat = qtf; dlg.Sizeable().Zoomable(); dlg.Run(); }
void AudacityProject::Copy(wxCommandEvent & event) { ClearClipboard(); TrackListIterator iter(mTracks); VTrack *n = iter.First(); VTrack *dest = 0; while (n) { if (n->GetSelected()) { n->Copy(mViewInfo.sel0, mViewInfo.sel1, &dest); if (dest) msClipboard->Add(dest); } n = iter.Next(); } msClipLen = (mViewInfo.sel1 - mViewInfo.sel0); msClipProject = this; }
void AudacityProject::Copy(wxEvent & event) { ClearClipboard(); TrackListIterator iter(mTracks); VTrack *n = iter.First(); VTrack *dest = 0; while (n) { if (n->GetSelected()) { n->Copy(mViewInfo.sel0, mViewInfo.sel1, &dest); if (dest) msClipboard->Add(dest); } n = iter.Next(); } msClipLen = (mViewInfo.sel1 - mViewInfo.sel0); msClipProject = this; //Make sure the menus/toolbar states get updated mTrackPanel->Refresh(false); }
void SwitchToMode(SwitchMode new_mode) { #ifdef ENABLE_NETWORK /* If we are saving something, the network stays in his current state */ if (new_mode != SM_SAVE_GAME) { /* If the network is active, make it not-active */ if (_networking) { if (_network_server && (new_mode == SM_LOAD_GAME || new_mode == SM_NEWGAME || new_mode == SM_RESTARTGAME)) { NetworkReboot(); } else { NetworkDisconnect(); } } /* If we are a server, we restart the server */ if (_is_network_server) { /* But not if we are going to the menu */ if (new_mode != SM_MENU) { /* check if we should reload the config */ if (_settings_client.network.reload_cfg) { LoadFromConfig(); MakeNewgameSettingsLive(); ResetGRFConfig(false); } NetworkServerStart(); } else { /* This client no longer wants to be a network-server */ _is_network_server = false; } } } #endif /* ENABLE_NETWORK */ if (new_mode != SM_SAVE_GAME) { /* Make sure all AI controllers are gone at quitting game */ AI::KillAll(); /* Clear the clipboard */ ClearClipboard(); } switch (new_mode) { case SM_EDITOR: // Switch to scenario editor MakeNewEditorWorld(); break; case SM_RESTARTGAME: // Restart --> 'Random game' with current settings case SM_NEWGAME: // New Game --> 'Random game' #ifdef ENABLE_NETWORK if (_network_server) { seprintf(_network_game_info.map_name, lastof(_network_game_info.map_name), "Random Map"); } #endif /* ENABLE_NETWORK */ MakeNewGame(false, new_mode == SM_NEWGAME); break; case SM_LOAD_GAME: { // Load game, Play Scenario ResetGRFConfig(true); ResetWindowSystem(); if (!SafeLoad(_file_to_saveload.name, _file_to_saveload.mode, GM_NORMAL, NO_DIRECTORY)) { SetDParamStr(0, GetSaveLoadErrorString()); ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_ERROR); } else { if (_saveload_mode == SLD_LOAD_SCENARIO) { /* Reset engine pool to simplify changing engine NewGRFs in scenario editor. */ EngineOverrideManager::ResetToCurrentNewGRFConfig(); } /* Update the local company for a loaded game. It is either always * company #1 (eg 0) or in the case of a dedicated server a spectator */ SetLocalCompany(_network_dedicated ? COMPANY_SPECTATOR : COMPANY_FIRST); /* Execute the game-start script */ IConsoleCmdExec("exec scripts/game_start.scr 0"); /* Decrease pause counter (was increased from opening load dialog) */ DoCommandP(0, PM_PAUSED_SAVELOAD, 0, CMD_PAUSE); #ifdef ENABLE_NETWORK if (_network_server) { seprintf(_network_game_info.map_name, lastof(_network_game_info.map_name), "%s (Loaded game)", _file_to_saveload.title); } #endif /* ENABLE_NETWORK */ } break; } case SM_START_HEIGHTMAP: // Load a heightmap and start a new game from it #ifdef ENABLE_NETWORK if (_network_server) { seprintf(_network_game_info.map_name, lastof(_network_game_info.map_name), "%s (Heightmap)", _file_to_saveload.title); } #endif /* ENABLE_NETWORK */ MakeNewGame(true, true); break; case SM_LOAD_HEIGHTMAP: // Load heightmap from scenario editor SetLocalCompany(OWNER_NONE); FixConfigMapSize(); GenerateWorld(GWM_HEIGHTMAP, 1 << _settings_game.game_creation.map_x, 1 << _settings_game.game_creation.map_y); MarkWholeScreenDirty(); break; case SM_LOAD_SCENARIO: { // Load scenario from scenario editor if (SafeLoad(_file_to_saveload.name, _file_to_saveload.mode, GM_EDITOR, NO_DIRECTORY)) { SetLocalCompany(OWNER_NONE); _settings_newgame.game_creation.starting_year = _cur_year; /* Cancel the saveload pausing */ DoCommandP(0, PM_PAUSED_SAVELOAD, 0, CMD_PAUSE); } else { SetDParamStr(0, GetSaveLoadErrorString()); ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_ERROR); } break; } case SM_MENU: // Switch to game intro menu LoadIntroGame(); if (BaseSounds::ini_set == NULL && BaseSounds::GetUsedSet()->fallback) { ShowErrorMessage(STR_WARNING_FALLBACK_SOUNDSET, INVALID_STRING_ID, WL_CRITICAL); BaseSounds::ini_set = stredup(BaseSounds::GetUsedSet()->name); } break; case SM_SAVE_GAME: // Save game. /* Make network saved games on pause compatible to singleplayer */ if (SaveOrLoad(_file_to_saveload.name, SL_SAVE, NO_DIRECTORY) != SL_OK) { SetDParamStr(0, GetSaveLoadErrorString()); ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_ERROR); } else { DeleteWindowById(WC_SAVELOAD, 0); } break; case SM_SAVE_HEIGHTMAP: // Save heightmap. MakeHeightmapScreenshot(_file_to_saveload.name); DeleteWindowById(WC_SAVELOAD, 0); break; case SM_GENRANDLAND: // Generate random land within scenario editor SetLocalCompany(OWNER_NONE); FixConfigMapSize(); GenerateWorld(GWM_RANDOM, 1 << _settings_game.game_creation.map_x, 1 << _settings_game.game_creation.map_y); /* XXX: set date */ MarkWholeScreenDirty(); break; default: NOT_REACHED(); } }
//------------------------------------------------- void ResetBuffer() { VnKbd.clearBuf(); ClearClipboard(); }
//------------------------------------------------- LRESULT CALLBACK MyKeyHook(int code, WPARAM wParam, LPARAM lParam) { int keyType; unsigned short charBuf; if (!pShMem->Initialized) return 0; if (code < 0) return CallNextHookEx(pShMem->keyHook,code,wParam,lParam); // determine if current window is a console, if so returns TCHAR className[128]; className[0] = 0; GetClassName(GetForegroundWindow(), className, 128); if (_tcscmp(className, _T("ConsoleWindowClass")) == 0) return CallNextHookEx(pShMem->keyHook,code,wParam,lParam); GetKeyboardState(KeyState); HKL curLayout = GetKeyboardLayout(0); if (curLayout != OriginalLayout && curLayout != ViKeyboardLayout) OriginalLayout = curLayout; if (CheckSwitchKey(wParam,lParam) || CheckShortcuts(wParam, lParam)) return 1; if ((pShMem->vietKey || (pShMem->options.macroEnabled && pShMem->options.alwaysMacro)) && code == HC_ACTION && !ClipboardIsEmpty) { if (wParam != PasteKey1 && wParam != PasteKey2 && !(lParam & IsReleased)) { // postpone this key keybd_event(wParam, HIBYTE(LOWORD(lParam)), (lParam & IsExtended)? KEYEVENTF_EXTENDEDKEY : 0, 0); return 1; } if (wParam == PasteKey2 && (lParam & IsReleased)) { ClearClipboard(); } } if (CheckBack(wParam)) return 1; if ((pShMem->vietKey || (pShMem->options.macroEnabled && pShMem->options.alwaysMacro)) && (code == HC_ACTION) && !(lParam & IsReleased)) { // if (CheckBack(wParam)) return 1; if (PuttingBacks) { if (wParam != VK_BACK) { keybd_event(wParam, HIBYTE(LOWORD(lParam)), (lParam & IsExtended)? KEYEVENTF_EXTENDEDKEY : 0, 0); return 1; } return CallNextHookEx(pShMem->keyHook,code,wParam,lParam); } if (pShMem->keyMode != WINCP1258_CHARSET && LayoutChangeForced) { ActivateKeyboardLayout(OriginalLayout, 0); LayoutChangeForced = 0; } // HKL curLayout = GetKeyboardLayout(0); if (((KeyState[VK_CONTROL] & 0x80) == 0 && (KeyState[VK_MENU] & 0x80) == 0) || ( curLayout != UsKeyboardLayout && ClipboardIsEmpty)) { //(pShMem->inMethod == VIQR_INPUT || pShMem->inMethod == VIQR_STAR_INPUT) && int remap = 0; keyType = ToAscii(wParam,UINT(HIWORD(lParam)),KeyState, &charBuf, 0); if (keyType == 1 && UsKeyboardLayout && ViKeyboardLayout && (KeyState[VK_CONTROL] & 0x80) == 0 && (KeyState[VK_MENU] & 0x80) == 0 && curLayout == ViKeyboardLayout) { //need to remap unsigned short mappedChar; int res = ToAsciiEx(wParam, UINT(HIWORD(lParam)), KeyState, &mappedChar, 0, UsKeyboardLayout); if (res == 1 && ((unsigned char)mappedChar) != ((unsigned char)charBuf)) { charBuf = mappedChar; remap = 1; } } if (keyType == 1 || keyType < 0) { unsigned char c = (unsigned char)charBuf; if (wParam >= VK_NUMPAD0 && wParam <= VK_NUMPAD9) VnKbd.putChar(c); // don't process numeric keypad else { VnKbd.process(c); if (VnKbd.backs!=0 || VnKbd.keysPushed!=0) { if (keyType < 0) //dead key, one more back VnKbd.backs++; PushBacks(); return 1; } if (remap) { SHORT scanCode = VkKeyScan((unsigned char)charBuf); lParam = (scanCode << 16) + 1; PostMessage(GetFocus(), (pShMem->options.useIME)? WM_IME_CHAR : WM_CHAR, (unsigned char)charBuf, lParam); return 1; } } } else { if (wParam!=VK_SHIFT && wParam!=VK_INSERT && wParam != VK_MENU && wParam != VK_CONTROL && ClipboardIsEmpty) { ResetBuffer(); } } } else { if (wParam != VK_MENU && wParam != VK_CONTROL && ClipboardIsEmpty) { ResetBuffer(); } } } else if ((code == HC_ACTION) && !(lParam & IsReleased)) { if (LayoutChangeForced && OriginalLayout && GetKeyboardLayout(0) == ViKeyboardLayout && OriginalLayout != ViKeyboardLayout) { ActivateKeyboardLayout(OriginalLayout, 0); LayoutChangeForced = 0; if (ToAsciiEx(wParam, UINT(HIWORD(lParam)), KeyState, &charBuf, 0, OriginalLayout) == 1) { SHORT scanCode = VkKeyScan((unsigned char)charBuf); lParam = (scanCode << 16) + 1; PostMessage(GetFocus(), (pShMem->options.useIME)? WM_IME_CHAR : WM_CHAR, (unsigned char)charBuf, lParam); return 1; } } } return CallNextHookEx(pShMem->keyHook,code,wParam,lParam); }