const char16_t* WrapperDLL::Tool_OpenDialog(void* self,const char16_t* filterList,const char16_t* defaultPath){ auto self_ = (Tool*)self; auto arg0 = filterList; auto arg1 = defaultPath; auto ret = self_->OpenDialog(arg0,arg1); return ret; };
bool KSaneWidget::openDevice(const QString &device_name) { //qDebug() << "KSaneWidget::openDevice" << device_name; if (!d->OpenSource(device_name)) return false; QTimer::singleShot(0, d, SLOT(OpenDialog())); return true; }
int OpenFile(HWND hwnd, TCHAR* fullPath, TCHAR* fileName,SDL_Rect *showRect) { if (!OpenDialog(hwnd, fullPath, fileName)) { MessageBox(0, TEXT("无法打开文件!"), 0, MB_ICONERROR); return 0; } SetWindowText(hwnd, fileName); return 1; }
void mxtOctreeScene::LodaFemSurfData() { femsurf = new txFemSurf; char *filename = OpenDialog(); if ( !filename ) { exit(0); } femsurf->LoadFemFile(filename); }
void CCEDT_Dlg::OnBnClickedCedtSetRecogDoc() { CString Fname; CString Fpath; CFileDialog OpenDialog(TRUE, NULL, NULL, OFN_FILEMUSTEXIST | OFN_READONLY | OFN_PATHMUSTEXIST, _T(""), NULL); int nModal = OpenDialog.DoModal(); if (nModal == IDOK){ Fpath = OpenDialog.GetPathName(); //Fpath = Fpath.Left(Fpath.ReverseFind('\\') + 1); Fname = OpenDialog.GetFileName(); m_DocPathEdit.SetWindowTextW(Fpath); NE_Doc_Path = NLPOP::CString2string(Fpath); string outstr = "\"" + NLPOP::CString2string(Fname); outstr += "\" is Selected..."; p_CParentDlg->Output_MSG(outstr.c_str(), 1); } }
Demo::Demo(QWidget* parent) : QWidget(parent), ui_(new Ui_Demo), timer_(new QTimer(this)) { ui_->setupUi(this); connect(timer_, SIGNAL(timeout()), SLOT(TimerFired())); connect(ui_->timer_speed, SIGNAL(valueChanged(int)), SLOT(SetTimerSpeed(int))); connect(ui_->manual_dial, SIGNAL(valueChanged(int)), SLOT(SetManualValue(int))); connect(ui_->manual_scroll, SIGNAL(valueChanged(int)), SLOT(SetManualValue(int))); connect(ui_->manual_slider, SIGNAL(valueChanged(int)), SLOT(SetManualValue(int))); connect(ui_->dialog_open, SIGNAL(clicked()), SLOT(OpenDialog())); SetTimerSpeed(ui_->timer_speed->value()); timer_->start(); }
void UIPathSelector::Init() { child_button = UIButton::Create(window,"..."); child_entry = UITextEntry::Create(window,path); Insert(child_entry, UIBox::PackMode::WIDE); Insert(child_button, UIBox::PackMode::TIGHT); child_button->SetBorder(false); child_button->SetCustomSize(Size2D(16,16)); child_button->SetInnerMargin(0); subscriptions += child_button->on_clicked.Subscribe([this](){ OpenDialog(); }); subscriptions += child_entry->on_edited.Subscribe([this](){ path = child_entry->GetText(); }); }
CGUIDialogCache::CGUIDialogCache(DWORD dwDelay, const CStdString& strHeader, const CStdString& strMsg) { m_pDlg = (CGUIDialogProgress*)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS); /* if progress dialog is already running, take it over */ if( m_pDlg->IsDialogRunning() ) dwDelay = 0; m_strHeader = strHeader; m_strLinePrev = strMsg; bSentCancel = false; if(dwDelay == 0) OpenDialog(); else m_endtime.Set((unsigned int)dwDelay); Create(true); }
/*********************************************************************************** ** Execute a file chooser dialog ** NB: this will fork ** ** KDEOpFileChooser::Execute ***********************************************************************************/ OP_STATUS KDEOpFileChooser::Execute(OpWindow* parent, DesktopFileChooserListener* listener, const DesktopFileChooserRequest& request) { // Don't call twice if (m_childpid) return OpStatus::ERR; m_listener = listener; // Prepare communication pipe if (pipe(m_pipe_descriptor) != 0) return OpStatus::ERR; // fork() and check for error m_childpid = fork(); if (m_childpid == 0) { // Child ClosePipe(PipeRead); dup2(m_pipe_descriptor[PipeWrite], fileno(stdout)); if (OpStatus::IsError(OpenDialog(request))) exit(1); } else if (m_childpid > 0) { // Parent ClosePipe(PipeWrite); g_main_message_handler->SetCallBack(this, MSG_FILE_CHOOSER_SHOW, reinterpret_cast<MH_PARAM_1>(this)); g_main_message_handler->PostMessage(MSG_FILE_CHOOSER_SHOW, reinterpret_cast<MH_PARAM_1>(this), 0, 100); } else { // Error occured m_childpid = 0; return OpStatus::ERR; } return OpStatus::OK; }
CGUIDialogCache::CGUIDialogCache(DWORD dwDelay, const CStdString& strHeader, const CStdString& strMsg) { m_pDlg = (CGUIDialogProgress*)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS); /* if progress dialog is already running, take it over */ if( m_pDlg->IsDialogRunning() ) dwDelay = 0; m_strHeader = strHeader; m_strLinePrev = strMsg; bSentCancel = false; if(dwDelay == 0) OpenDialog(); else m_dwTimeStamp = XbmcThreads::SystemClockMillis() + dwDelay; Create(true); }
MainWindow::MainWindow(QApplication* a,QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); this->app = a; lang = new Language(app); if(!lang) return; connect(ui->pushButton_quit,SIGNAL(clicked()),this,SLOT(close())); connect(ui->pushButton_dialog,SIGNAL(clicked()),this,SLOT(OpenDialog())); QList<QRadioButton*> list = ui->groupBox->findChildren<QRadioButton*>(); for(int i=0;i<list.size();i++) { QRadioButton* rb = list.at(i); connect(rb,SIGNAL(clicked()),this,SLOT(ChangeLanguage())); } lang->ChangeLanguage("suomi.qm"); ui->retranslateUi(this); std::clog<<"Window opened"<<std::endl; }
void CGUIDialogCache::Process() { if (!m_pDlg) return; while( true ) { { //Section to make the lock go out of scope before sleep if( CThread::m_bStop ) break; try { CSingleLock lock(g_graphicsContext); m_pDlg->Progress(); if( bSentCancel ) { Sleep(10); continue; } if(m_pDlg->IsCanceled()) { bSentCancel = true; } else if( !m_pDlg->IsDialogRunning() && m_endtime.IsTimePast() && !g_windowManager.IsWindowActive(WINDOW_DIALOG_YES_NO) ) OpenDialog(); } catch(...) { CLog::Log(LOGERROR, "Exception in CGUIDialogCache::Process()"); } } Sleep(10); } }
long EditorWindow::onLoad(FXObject*, FXSelector, void*) { bool Continue = SaveChanges(); if (Continue) { FXString FileName; FXFileDialog OpenDialog(this,"Apri Progetto"); OpenDialog.setSelectMode(SELECTFILE_EXISTING); OpenDialog.setPatternList("Bezier Patch Project (*.bzp)"); //OpenDialog.setCurrentPattern(); OpenDialog.setFilename(""); if(OpenDialog.execute()) { FileName = OpenDialog.getFilename(); View[0]->makeCurrent(); PM->Load(FileName.text()); View[0]->makeNonCurrent(); redrawAllViewports(); } } return 1; }
LRESULT CMainWindow::DoCommand(int id, LPARAM lParam) { switch (id) { case ID_FILE_OPEN: { if (OpenDialog()) { picWindow1.SetPic(leftpicpath, L"", true); picWindow2.SetPic(rightpicpath, L"", false); if (bOverlap) { picWindow1.SetSecondPic(picWindow2.GetPic(), rightpictitle, rightpicpath); } else { picWindow1.SetSecondPic(); } RECT rect; GetClientRect(*this, &rect); PositionChildren(&rect); picWindow1.FitImageInWindow(); picWindow2.FitImageInWindow(); } } break; case ID_VIEW_IMAGEINFO: { bShowInfo = !bShowInfo; HMENU hMenu = GetMenu(*this); UINT uCheck = MF_BYCOMMAND; uCheck |= bShowInfo ? MF_CHECKED : MF_UNCHECKED; CheckMenuItem(hMenu, ID_VIEW_IMAGEINFO, uCheck); picWindow1.ShowInfo(bShowInfo); picWindow2.ShowInfo(bShowInfo); picWindow3.ShowInfo(bShowInfo); // change the state of the toolbar button TBBUTTONINFO tbi; tbi.cbSize = sizeof(TBBUTTONINFO); tbi.dwMask = TBIF_STATE; tbi.fsState = bShowInfo ? TBSTATE_CHECKED | TBSTATE_ENABLED : TBSTATE_ENABLED; SendMessage(hwndTB, TB_SETBUTTONINFO, ID_VIEW_IMAGEINFO, (LPARAM)&tbi); } break; case ID_VIEW_OVERLAPIMAGES: { bOverlap = !bOverlap; HMENU hMenu = GetMenu(*this); UINT uCheck = MF_BYCOMMAND; uCheck |= bOverlap ? MF_CHECKED : MF_UNCHECKED; CheckMenuItem(hMenu, ID_VIEW_OVERLAPIMAGES, uCheck); uCheck |= ((m_BlendType == CPicWindow::BLEND_ALPHA) && bOverlap) ? MF_CHECKED : MF_UNCHECKED; CheckMenuItem(hMenu, ID_VIEW_BLENDALPHA, uCheck); UINT uEnabled = MF_BYCOMMAND; uEnabled |= bOverlap ? MF_ENABLED : MF_DISABLED | MF_GRAYED; EnableMenuItem(hMenu, ID_VIEW_BLENDALPHA, uEnabled); // change the state of the toolbar button TBBUTTONINFO tbi; tbi.cbSize = sizeof(TBBUTTONINFO); tbi.dwMask = TBIF_STATE; tbi.fsState = bOverlap ? TBSTATE_CHECKED | TBSTATE_ENABLED : TBSTATE_ENABLED; SendMessage(hwndTB, TB_SETBUTTONINFO, ID_VIEW_OVERLAPIMAGES, (LPARAM)&tbi); tbi.fsState = ((m_BlendType == CPicWindow::BLEND_ALPHA) && bOverlap) ? TBSTATE_CHECKED : 0; if (bOverlap) tbi.fsState |= TBSTATE_ENABLED; else tbi.fsState = 0; SendMessage(hwndTB, TB_SETBUTTONINFO, ID_VIEW_BLENDALPHA, (LPARAM)&tbi); if (bOverlap) tbi.fsState = 0; else tbi.fsState = bVertical ? TBSTATE_ENABLED | TBSTATE_CHECKED : TBSTATE_ENABLED; SendMessage(hwndTB, TB_SETBUTTONINFO, ID_VIEW_ARRANGEVERTICAL, (LPARAM)&tbi); if (bOverlap) { bLinkedPositions = true; picWindow1.LinkPositions(bLinkedPositions); picWindow2.LinkPositions(bLinkedPositions); tbi.fsState = TBSTATE_CHECKED; } else tbi.fsState = bLinkedPositions ? TBSTATE_ENABLED | TBSTATE_CHECKED : TBSTATE_ENABLED; SendMessage(hwndTB, TB_SETBUTTONINFO, ID_VIEW_LINKIMAGESTOGETHER, (LPARAM)&tbi); ShowWindow(picWindow2, bOverlap ? SW_HIDE : SW_SHOW); if (bOverlap) { picWindow1.StopTimer(); picWindow2.StopTimer(); picWindow1.SetSecondPic(picWindow2.GetPic(), rightpictitle, rightpicpath, picWindow2.GetHPos(), picWindow2.GetVPos()); picWindow1.SetBlendAlpha(m_BlendType, 0.5f); } else { picWindow1.SetSecondPic(); } picWindow1.SetOverlapMode(bOverlap); picWindow2.SetOverlapMode(bOverlap); RECT rect; GetClientRect(*this, &rect); PositionChildren(&rect); return 0; } break; case ID_VIEW_BLENDALPHA: { if (m_BlendType == CPicWindow::BLEND_ALPHA) m_BlendType = CPicWindow::BLEND_XOR; else m_BlendType = CPicWindow::BLEND_ALPHA; HMENU hMenu = GetMenu(*this); UINT uCheck = MF_BYCOMMAND; uCheck |= ((m_BlendType == CPicWindow::BLEND_ALPHA) && bOverlap) ? MF_CHECKED : MF_UNCHECKED; CheckMenuItem(hMenu, ID_VIEW_BLENDALPHA, uCheck); UINT uEnabled = MF_BYCOMMAND; uEnabled |= bOverlap ? MF_ENABLED : MF_DISABLED | MF_GRAYED; EnableMenuItem(hMenu, ID_VIEW_BLENDALPHA, uEnabled); // change the state of the toolbar button TBBUTTONINFO tbi; tbi.cbSize = sizeof(TBBUTTONINFO); tbi.dwMask = TBIF_STATE; tbi.fsState = ((m_BlendType == CPicWindow::BLEND_ALPHA) && bOverlap) ? TBSTATE_CHECKED | TBSTATE_ENABLED : TBSTATE_ENABLED; SendMessage(hwndTB, TB_SETBUTTONINFO, ID_VIEW_BLENDALPHA, (LPARAM)&tbi); picWindow1.SetBlendAlpha(m_BlendType, picWindow1.GetBlendAlpha()); PositionChildren(); } break; case ID_VIEW_TRANSPARENTCOLOR: { static COLORREF customColors[16] = {0}; CHOOSECOLOR ccDlg = { 0 }; ccDlg.lStructSize = sizeof(ccDlg); ccDlg.hwndOwner = m_hwnd; ccDlg.rgbResult = transparentColor; ccDlg.lpCustColors = customColors; ccDlg.Flags = CC_RGBINIT | CC_FULLOPEN; if(ChooseColor(&ccDlg)) { transparentColor = ccDlg.rgbResult; picWindow1.SetTransparentColor(transparentColor); picWindow2.SetTransparentColor(transparentColor); picWindow3.SetTransparentColor(transparentColor); // The color picker takes the focus and we don't get it back. ::SetFocus(picWindow1); } } break; case ID_VIEW_FITIMAGEWIDTHS: { bFitWidths = !bFitWidths; picWindow1.FitWidths(bFitWidths); picWindow2.FitWidths(bFitWidths); picWindow3.FitWidths(bFitWidths); HMENU hMenu = GetMenu(*this); UINT uCheck = MF_BYCOMMAND; uCheck |= bFitWidths ? MF_CHECKED : MF_UNCHECKED; CheckMenuItem(hMenu, ID_VIEW_FITIMAGEWIDTHS, uCheck); // change the state of the toolbar button TBBUTTONINFO tbi; tbi.cbSize = sizeof(TBBUTTONINFO); tbi.dwMask = TBIF_STATE; tbi.fsState = bFitWidths ? TBSTATE_CHECKED | TBSTATE_ENABLED : TBSTATE_ENABLED; SendMessage(hwndTB, TB_SETBUTTONINFO, ID_VIEW_FITIMAGEWIDTHS, (LPARAM)&tbi); } break; case ID_VIEW_FITIMAGEHEIGHTS: { bFitHeights = !bFitHeights; picWindow1.FitHeights(bFitHeights); picWindow2.FitHeights(bFitHeights); picWindow3.FitHeights(bFitHeights); HMENU hMenu = GetMenu(*this); UINT uCheck = MF_BYCOMMAND; uCheck |= bFitHeights ? MF_CHECKED : MF_UNCHECKED; CheckMenuItem(hMenu, ID_VIEW_FITIMAGEHEIGHTS, uCheck); // change the state of the toolbar button TBBUTTONINFO tbi; tbi.cbSize = sizeof(TBBUTTONINFO); tbi.dwMask = TBIF_STATE; tbi.fsState = bFitHeights ? TBSTATE_CHECKED | TBSTATE_ENABLED : TBSTATE_ENABLED; SendMessage(hwndTB, TB_SETBUTTONINFO, ID_VIEW_FITIMAGEHEIGHTS, (LPARAM)&tbi); } break; case ID_VIEW_LINKIMAGESTOGETHER: { bLinkedPositions = !bLinkedPositions; picWindow1.LinkPositions(bLinkedPositions); picWindow2.LinkPositions(bLinkedPositions); picWindow3.LinkPositions(bLinkedPositions); HMENU hMenu = GetMenu(*this); UINT uCheck = MF_BYCOMMAND; uCheck |= bLinkedPositions ? MF_CHECKED : MF_UNCHECKED; CheckMenuItem(hMenu, ID_VIEW_LINKIMAGESTOGETHER, uCheck); // change the state of the toolbar button TBBUTTONINFO tbi; tbi.cbSize = sizeof(TBBUTTONINFO); tbi.dwMask = TBIF_STATE; tbi.fsState = bLinkedPositions ? TBSTATE_CHECKED | TBSTATE_ENABLED : TBSTATE_ENABLED; SendMessage(hwndTB, TB_SETBUTTONINFO, ID_VIEW_LINKIMAGESTOGETHER, (LPARAM)&tbi); } break; case ID_VIEW_ALPHA0: picWindow1.SetBlendAlpha(m_BlendType, 0.0f); break; case ID_VIEW_ALPHA255: picWindow1.SetBlendAlpha(m_BlendType, 1.0f); break; case ID_VIEW_ALPHA127: picWindow1.SetBlendAlpha(m_BlendType, 0.5f); break; case ID_VIEW_ALPHATOGGLE: picWindow1.ToggleAlpha(); break; case ID_VIEW_FITIMAGESINWINDOW: { picWindow1.FitImageInWindow(); picWindow2.FitImageInWindow(); picWindow3.FitImageInWindow(); } break; case ID_VIEW_ORININALSIZE: { picWindow1.SetZoom(100, false); picWindow2.SetZoom(100, false); picWindow3.SetZoom(100, false); picWindow1.CenterImage(); picWindow2.CenterImage(); picWindow3.CenterImage(); } break; case ID_VIEW_ZOOMIN: { picWindow1.Zoom(true, false); if ((!(bFitWidths || bFitHeights))&&(!bOverlap)) { picWindow2.Zoom(true, false); picWindow3.Zoom(true, false); } } break; case ID_VIEW_ZOOMOUT: { picWindow1.Zoom(false, false); if ((!(bFitWidths || bFitHeights))&&(!bOverlap)) { picWindow2.Zoom(false, false); picWindow3.Zoom(false, false); } } break; case ID_VIEW_ARRANGEVERTICAL: { bVertical = !bVertical; RECT rect; GetClientRect(*this, &rect); if (bVertical) { RECT tbRect; GetWindowRect(hwndTB, &tbRect); LONG tbHeight = tbRect.bottom-tbRect.top-1; if (selectionPaths.size() != 3) { nSplitterPos = (rect.bottom-rect.top)/2+tbHeight; nSplitterPos2 = 0; } else { nSplitterPos = (rect.bottom-rect.top)/3+tbHeight; nSplitterPos2 = (rect.bottom-rect.top)*2/3+tbHeight; } } else { if (selectionPaths.size() != 3) { nSplitterPos = (rect.right-rect.left)/2; nSplitterPos2 = 0; } else { nSplitterPos = (rect.right-rect.left)/3; nSplitterPos2 = (rect.right-rect.left)*2/3; } } HMENU hMenu = GetMenu(*this); UINT uCheck = MF_BYCOMMAND; uCheck |= bVertical ? MF_CHECKED : MF_UNCHECKED; CheckMenuItem(hMenu, ID_VIEW_ARRANGEVERTICAL, uCheck); // change the state of the toolbar button TBBUTTONINFO tbi; tbi.cbSize = sizeof(TBBUTTONINFO); tbi.dwMask = TBIF_STATE; tbi.fsState = bVertical ? TBSTATE_CHECKED | TBSTATE_ENABLED : TBSTATE_ENABLED; SendMessage(hwndTB, TB_SETBUTTONINFO, ID_VIEW_ARRANGEVERTICAL, (LPARAM)&tbi); PositionChildren(&rect); } break; case ID_ABOUT: { CAboutDlg dlg(*this); dlg.DoModal(hInst, IDD_ABOUT, *this); } break; case SELECTBUTTON_ID: { HWND hSource = (HWND)lParam; FileType resolveWith; if (picWindow1 == hSource) resolveWith = FileTypeMine; else if (picWindow2 == hSource) resolveWith = FileTypeBase; else if (picWindow3 == hSource) resolveWith = FileTypeTheirs; else break; if (selectionResult.empty()) { PostQuitMessage(resolveWith); break; } CopyFile(selectionPaths[resolveWith].c_str(), selectionResult.c_str(), FALSE); CAutoBuf projectRoot; if (git_repository_discover(projectRoot, CUnicodeUtils::GetUTF8(selectionResult.c_str()), FALSE, nullptr) < 0 && strstr(projectRoot->ptr, "/.git/")) { PostQuitMessage(resolveWith); break; } CAutoRepository repository(projectRoot->ptr); if (!repository) { PostQuitMessage(resolveWith); break; } CStringA subpath = CUnicodeUtils::GetUTF8(selectionResult.c_str()).Mid((int)strlen(git_repository_workdir(repository))); CAutoIndex index; if (git_repository_index(index.GetPointer(), repository) || (git_index_get_bypath(index, subpath, 1) == nullptr && git_index_get_bypath(index, subpath, 2) == nullptr)) { PostQuitMessage(resolveWith); break; } CString sTemp; sTemp.Format(ResString(hResource, IDS_MARKASRESOLVED), (LPCTSTR)CPathUtils::GetFileNameFromPath(selectionResult.c_str())); if (MessageBox(m_hwnd, sTemp, L"TortoiseGitMerge", MB_YESNO | MB_ICONQUESTION) != IDYES) break; CString cmd; cmd.Format(L"\"%sTortoiseGitProc.exe\" /command:resolve /path:\"%s\" /closeonend:1 /noquestion /skipcheck /silent", (LPCTSTR)CPathUtils::GetAppDirectory(), selectionResult.c_str()); if (resolveMsgWnd) cmd.AppendFormat(L" /resolvemsghwnd:%I64d /resolvemsgwparam:%I64d /resolvemsglparam:%I64d", (__int64)resolveMsgWnd, (__int64)resolveMsgWParam, (__int64)resolveMsgLParam); STARTUPINFO startup = { 0 }; PROCESS_INFORMATION process = { 0 }; startup.cb = sizeof(startup); if (!CreateProcess(nullptr, cmd.GetBuffer(), nullptr, nullptr, FALSE, CREATE_UNICODE_ENVIRONMENT, nullptr, nullptr, &startup, &process)) { cmd.ReleaseBuffer(); PostQuitMessage(resolveWith); break; } cmd.ReleaseBuffer(); AllowSetForegroundWindow(process.dwProcessId); CloseHandle(process.hThread); CloseHandle(process.hProcess); PostQuitMessage(resolveWith); } break; case IDM_EXIT: ::PostQuitMessage(0); return 0; break; default: break; }; return 1; }
/* handle all WM_COMMAND messages here */ LONG WINAPI CommandHandler ( HWND hWnd, WPARAM wParam, LPARAM lParam) { HMENU hMenu; switch (LOWORD(wParam)) { // // file menu // case ID_FILE_EXIT: /* exit application */ if (!ConfirmModified()) return TRUE; PostMessage (hWnd, WM_CLOSE, 0, 0L); break; case ID_FILE_OPEN: if (!ConfirmModified()) return TRUE; OpenDialog (); break; case ID_FILE_NEW: if (!ConfirmModified()) return TRUE; Map_New (); break; case ID_FILE_SAVE: if (!strcmp(currentmap, "unnamed.map")) SaveAsDialog (); else Map_SaveFile (currentmap, false); // ignore region break; case ID_FILE_SAVEAS: SaveAsDialog (); break; case ID_FILE_LOADPROJECT: if (!ConfirmModified()) return TRUE; ProjectDialog (); break; case ID_FILE_POINTFILE: if (g_qeglobals.d_pointfile_display_list) Pointfile_Clear (); else Pointfile_Check (); break; // // view menu // case ID_VIEW_ENTITY: SetInspectorMode(W_ENTITY); break; case ID_VIEW_CONSOLE: SetInspectorMode(W_CONSOLE); break; case ID_VIEW_TEXTURE: SetInspectorMode(W_TEXTURE); break; case ID_VIEW_100: g_qeglobals.d_xy.scale = 1; Sys_UpdateWindows (W_XY|W_XY_OVERLAY); break; case ID_VIEW_ZOOMIN: g_qeglobals.d_xy.scale *= 5.0/4; if (g_qeglobals.d_xy.scale > 16) g_qeglobals.d_xy.scale = 16; Sys_UpdateWindows (W_XY|W_XY_OVERLAY); break; case ID_VIEW_ZOOMOUT: g_qeglobals.d_xy.scale *= 4.0/5; if (g_qeglobals.d_xy.scale < 0.1) g_qeglobals.d_xy.scale = 0.1; Sys_UpdateWindows (W_XY|W_XY_OVERLAY); break; case ID_VIEW_Z100: z.scale = 1; Sys_UpdateWindows (W_Z|W_Z_OVERLAY); break; case ID_VIEW_ZZOOMIN: z.scale *= 5.0/4; if (z.scale > 4) z.scale = 4; Sys_UpdateWindows (W_Z|W_Z_OVERLAY); break; case ID_VIEW_ZZOOMOUT: z.scale *= 4.0/5; if (z.scale < 0.125) z.scale = 0.125; Sys_UpdateWindows (W_Z|W_Z_OVERLAY); break; case ID_VIEW_CENTER: camera.angles[ROLL] = camera.angles[PITCH] = 0; camera.angles[YAW] = 22.5 * floor( (camera.angles[YAW]+11)/22.5 ); Sys_UpdateWindows (W_CAMERA|W_XY_OVERLAY); break; case ID_VIEW_UPFLOOR: Cam_ChangeFloor (true); break; case ID_VIEW_DOWNFLOOR: Cam_ChangeFloor (false); break; case ID_VIEW_SHOWNAMES: g_qeglobals.d_savedinfo.show_names = !g_qeglobals.d_savedinfo.show_names; CheckMenuItem ( GetMenu(g_qeglobals.d_hwndMain), ID_VIEW_SHOWNAMES, MF_BYCOMMAND | (g_qeglobals.d_savedinfo.show_names ? MF_CHECKED : MF_UNCHECKED) ); Map_BuildBrushData(); Sys_UpdateWindows (W_XY); break; case ID_VIEW_SHOWCOORDINATES: g_qeglobals.d_savedinfo.show_coordinates ^= 1; CheckMenuItem ( GetMenu(g_qeglobals.d_hwndMain), ID_VIEW_SHOWCOORDINATES, MF_BYCOMMAND | (g_qeglobals.d_savedinfo.show_coordinates ? MF_CHECKED : MF_UNCHECKED) ); Sys_UpdateWindows (W_XY); break; case ID_VIEW_SHOWBLOCKS: g_qeglobals.show_blocks ^= 1; CheckMenuItem ( GetMenu(g_qeglobals.d_hwndMain), ID_VIEW_SHOWBLOCKS, MF_BYCOMMAND | (g_qeglobals.show_blocks ? MF_CHECKED : MF_UNCHECKED) ); Sys_UpdateWindows (W_XY); break; case ID_VIEW_SHOWLIGHTS: if ( ( g_qeglobals.d_savedinfo.exclude ^= EXCLUDE_LIGHTS ) & EXCLUDE_LIGHTS ) CheckMenuItem ( GetMenu(g_qeglobals.d_hwndMain), ID_VIEW_SHOWLIGHTS, MF_BYCOMMAND | MF_UNCHECKED ); else CheckMenuItem ( GetMenu(g_qeglobals.d_hwndMain), ID_VIEW_SHOWLIGHTS, MF_BYCOMMAND | MF_CHECKED ); Sys_UpdateWindows (W_XY|W_CAMERA); break; case ID_VIEW_SHOWPATH: if ( ( g_qeglobals.d_savedinfo.exclude ^= EXCLUDE_PATHS ) & EXCLUDE_PATHS ) CheckMenuItem ( GetMenu(g_qeglobals.d_hwndMain), ID_VIEW_SHOWPATH, MF_BYCOMMAND | MF_UNCHECKED ); else CheckMenuItem ( GetMenu(g_qeglobals.d_hwndMain), ID_VIEW_SHOWPATH, MF_BYCOMMAND | MF_CHECKED ); Sys_UpdateWindows (W_XY|W_CAMERA); break; case ID_VIEW_SHOWENT: if ( ( g_qeglobals.d_savedinfo.exclude ^= EXCLUDE_ENT ) & EXCLUDE_ENT ) CheckMenuItem( GetMenu(g_qeglobals.d_hwndMain), ID_VIEW_SHOWENT, MF_BYCOMMAND | MF_UNCHECKED); else CheckMenuItem( GetMenu(g_qeglobals.d_hwndMain), ID_VIEW_SHOWENT, MF_BYCOMMAND | MF_CHECKED); Sys_UpdateWindows (W_XY|W_CAMERA); break; case ID_VIEW_SHOWWATER: if ( ( g_qeglobals.d_savedinfo.exclude ^= EXCLUDE_WATER ) & EXCLUDE_WATER ) CheckMenuItem ( GetMenu(g_qeglobals.d_hwndMain), ID_VIEW_SHOWWATER, MF_BYCOMMAND | MF_UNCHECKED ); else CheckMenuItem ( GetMenu(g_qeglobals.d_hwndMain), ID_VIEW_SHOWWATER, MF_BYCOMMAND | MF_CHECKED ); Sys_UpdateWindows (W_XY|W_CAMERA); break; case ID_VIEW_SHOWCLIP: if ( ( g_qeglobals.d_savedinfo.exclude ^= EXCLUDE_CLIP ) & EXCLUDE_CLIP ) CheckMenuItem ( GetMenu(g_qeglobals.d_hwndMain), ID_VIEW_SHOWCLIP, MF_BYCOMMAND | MF_UNCHECKED ); else CheckMenuItem ( GetMenu(g_qeglobals.d_hwndMain), ID_VIEW_SHOWCLIP, MF_BYCOMMAND | MF_CHECKED ); Sys_UpdateWindows (W_XY|W_CAMERA); break; case ID_VIEW_SHOWDETAIL: if ( ( g_qeglobals.d_savedinfo.exclude ^= EXCLUDE_DETAIL ) & EXCLUDE_DETAIL ) { CheckMenuItem ( GetMenu(g_qeglobals.d_hwndMain), ID_VIEW_SHOWDETAIL, MF_BYCOMMAND | MF_UNCHECKED ); SetWindowText (g_qeglobals.d_hwndCamera, "Camera View (DETAIL EXCLUDED)"); } else { CheckMenuItem ( GetMenu(g_qeglobals.d_hwndMain), ID_VIEW_SHOWDETAIL, MF_BYCOMMAND | MF_CHECKED ); SetWindowText (g_qeglobals.d_hwndCamera, "Camera View"); } Sys_UpdateWindows (W_XY|W_CAMERA); break; case ID_VIEW_SHOWWORLD: if ( ( g_qeglobals.d_savedinfo.exclude ^= EXCLUDE_WORLD ) & EXCLUDE_WORLD ) CheckMenuItem ( GetMenu(g_qeglobals.d_hwndMain), ID_VIEW_SHOWWORLD, MF_BYCOMMAND | MF_UNCHECKED ); else CheckMenuItem ( GetMenu(g_qeglobals.d_hwndMain), ID_VIEW_SHOWWORLD, MF_BYCOMMAND | MF_CHECKED ); Sys_UpdateWindows (W_XY|W_CAMERA); break; // // grid menu // case ID_GRID_1: case ID_GRID_2: case ID_GRID_4: case ID_GRID_8: case ID_GRID_16: case ID_GRID_32: case ID_GRID_64: { hMenu = GetMenu(hWnd); CheckMenuItem(hMenu, ID_GRID_1, MF_BYCOMMAND | MF_UNCHECKED); CheckMenuItem(hMenu, ID_GRID_2, MF_BYCOMMAND | MF_UNCHECKED); CheckMenuItem(hMenu, ID_GRID_4, MF_BYCOMMAND | MF_UNCHECKED); CheckMenuItem(hMenu, ID_GRID_8, MF_BYCOMMAND | MF_UNCHECKED); CheckMenuItem(hMenu, ID_GRID_16, MF_BYCOMMAND | MF_UNCHECKED); CheckMenuItem(hMenu, ID_GRID_32, MF_BYCOMMAND | MF_UNCHECKED); CheckMenuItem(hMenu, ID_GRID_64, MF_BYCOMMAND | MF_UNCHECKED); switch (LOWORD(wParam)) { case ID_GRID_1: g_qeglobals.d_gridsize = 0; break; case ID_GRID_2: g_qeglobals.d_gridsize = 1; break; case ID_GRID_4: g_qeglobals.d_gridsize = 2; break; case ID_GRID_8: g_qeglobals.d_gridsize = 3; break; case ID_GRID_16: g_qeglobals.d_gridsize = 4; break; case ID_GRID_32: g_qeglobals.d_gridsize = 5; break; case ID_GRID_64: g_qeglobals.d_gridsize = 6; break; } g_qeglobals.d_gridsize = 1 << g_qeglobals.d_gridsize; CheckMenuItem(hMenu, LOWORD(wParam), MF_BYCOMMAND | MF_CHECKED); Sys_UpdateWindows (W_XY|W_Z); break; } // // texture menu // case ID_VIEW_NEAREST: case ID_VIEW_NEARESTMIPMAP: case ID_VIEW_LINEAR: case ID_VIEW_BILINEAR: case ID_VIEW_BILINEARMIPMAP: case ID_VIEW_TRILINEAR: case ID_TEXTURES_WIREFRAME: case ID_TEXTURES_FLATSHADE: Texture_SetMode (LOWORD(wParam)); break; case ID_TEXTURES_SHOWINUSE: Sys_BeginWait (); Texture_ShowInuse (); SetInspectorMode(W_TEXTURE); break; case ID_TEXTURES_INSPECTOR: DoSurface (); break; case CMD_TEXTUREWAD: case CMD_TEXTUREWAD+1: case CMD_TEXTUREWAD+2: case CMD_TEXTUREWAD+3: case CMD_TEXTUREWAD+4: case CMD_TEXTUREWAD+5: case CMD_TEXTUREWAD+6: case CMD_TEXTUREWAD+7: case CMD_TEXTUREWAD+8: case CMD_TEXTUREWAD+9: case CMD_TEXTUREWAD+10: case CMD_TEXTUREWAD+11: case CMD_TEXTUREWAD+12: case CMD_TEXTUREWAD+13: case CMD_TEXTUREWAD+14: case CMD_TEXTUREWAD+15: case CMD_TEXTUREWAD+16: case CMD_TEXTUREWAD+17: case CMD_TEXTUREWAD+18: case CMD_TEXTUREWAD+19: case CMD_TEXTUREWAD+20: case CMD_TEXTUREWAD+21: case CMD_TEXTUREWAD+22: case CMD_TEXTUREWAD+23: case CMD_TEXTUREWAD+24: case CMD_TEXTUREWAD+25: case CMD_TEXTUREWAD+26: case CMD_TEXTUREWAD+27: case CMD_TEXTUREWAD+28: case CMD_TEXTUREWAD+29: case CMD_TEXTUREWAD+30: case CMD_TEXTUREWAD+31: Sys_BeginWait (); Texture_ShowDirectory (LOWORD(wParam)); SetInspectorMode(W_TEXTURE); break; // // bsp menu // case CMD_BSPCOMMAND: case CMD_BSPCOMMAND+1: case CMD_BSPCOMMAND+2: case CMD_BSPCOMMAND+3: case CMD_BSPCOMMAND+4: case CMD_BSPCOMMAND+5: case CMD_BSPCOMMAND+6: case CMD_BSPCOMMAND+7: case CMD_BSPCOMMAND+8: case CMD_BSPCOMMAND+9: case CMD_BSPCOMMAND+10: case CMD_BSPCOMMAND+11: case CMD_BSPCOMMAND+12: case CMD_BSPCOMMAND+13: case CMD_BSPCOMMAND+14: case CMD_BSPCOMMAND+15: case CMD_BSPCOMMAND+16: case CMD_BSPCOMMAND+17: case CMD_BSPCOMMAND+18: case CMD_BSPCOMMAND+19: case CMD_BSPCOMMAND+20: case CMD_BSPCOMMAND+21: case CMD_BSPCOMMAND+22: case CMD_BSPCOMMAND+23: case CMD_BSPCOMMAND+24: case CMD_BSPCOMMAND+25: case CMD_BSPCOMMAND+26: case CMD_BSPCOMMAND+27: case CMD_BSPCOMMAND+28: case CMD_BSPCOMMAND+29: case CMD_BSPCOMMAND+30: case CMD_BSPCOMMAND+31: { extern char *bsp_commands[256]; RunBsp (bsp_commands[LOWORD(wParam-CMD_BSPCOMMAND)]); } break; // // misc menu // case ID_MISC_BENCHMARK: SendMessage ( g_qeglobals.d_hwndCamera, WM_USER+267, 0, 0); break; case ID_TEXTUREBK: DoColor(COLOR_TEXTUREBACK); Sys_UpdateWindows (W_ALL); break; case ID_MISC_SELECTENTITYCOLOR: { extern int inspector_mode; if ( ( inspector_mode == W_ENTITY ) && DoColor(COLOR_ENTITY) == true ) { extern void AddProp( void ); char buffer[100]; sprintf( buffer, "%f %f %f", g_qeglobals.d_savedinfo.colors[COLOR_ENTITY][0], g_qeglobals.d_savedinfo.colors[COLOR_ENTITY][1], g_qeglobals.d_savedinfo.colors[COLOR_ENTITY][2] ); SetWindowText( hwndEnt[EntValueField], buffer ); SetWindowText( hwndEnt[EntKeyField], "_color" ); AddProp(); } Sys_UpdateWindows( W_ALL ); } break; case ID_MISC_PRINTXY: WXY_Print(); break; case ID_COLORS_XYBK: DoColor(COLOR_GRIDBACK); Sys_UpdateWindows (W_ALL); break; case ID_COLORS_MAJOR: DoColor(COLOR_GRIDMAJOR); Sys_UpdateWindows (W_ALL); break; case ID_COLORS_MINOR: DoColor(COLOR_GRIDMINOR); Sys_UpdateWindows (W_ALL); break; case ID_MISC_GAMMA: DoGamma(); break; case ID_MISC_FINDBRUSH: DoFind(); break; case ID_MISC_NEXTLEAKSPOT: Pointfile_Next(); break; case ID_MISC_PREVIOUSLEAKSPOT: Pointfile_Prev(); break; // // brush menu // case ID_BRUSH_3SIDED: Brush_MakeSided (3); break; case ID_BRUSH_4SIDED: Brush_MakeSided (4); break; case ID_BRUSH_5SIDED: Brush_MakeSided (5); break; case ID_BRUSH_6SIDED: Brush_MakeSided (6); break; case ID_BRUSH_7SIDED: Brush_MakeSided (7); break; case ID_BRUSH_8SIDED: Brush_MakeSided (8); break; case ID_BRUSH_9SIDED: Brush_MakeSided (9); break; case ID_BRUSH_ARBITRARYSIDED: DoSides (); break; // // select menu // case ID_BRUSH_FLIPX: Select_FlipAxis (0); break; case ID_BRUSH_FLIPY: Select_FlipAxis (1); break; case ID_BRUSH_FLIPZ: Select_FlipAxis (2); break; case ID_BRUSH_ROTATEX: Select_RotateAxis (0, 90); break; case ID_BRUSH_ROTATEY: Select_RotateAxis (1, 90); break; case ID_BRUSH_ROTATEZ: Select_RotateAxis (2, 90); break; case ID_SELECTION_ARBITRARYROTATION: DoRotate (); break; case ID_SELECTION_UNGROUPENTITY: Select_Ungroup (); break; case ID_SELECTION_CONNECT: ConnectEntities (); break; case ID_SELECTION_DRAGVERTECIES: if (g_qeglobals.d_select_mode == sel_vertex) { g_qeglobals.d_select_mode = sel_brush; Sys_UpdateWindows (W_ALL); } else { SetupVertexSelection (); if (g_qeglobals.d_numpoints) g_qeglobals.d_select_mode = sel_vertex; } break; case ID_SELECTION_DRAGEDGES: if (g_qeglobals.d_select_mode == sel_edge) { g_qeglobals.d_select_mode = sel_brush; Sys_UpdateWindows (W_ALL); } else { SetupVertexSelection (); if (g_qeglobals.d_numpoints) g_qeglobals.d_select_mode = sel_edge; } break; case ID_SELECTION_SELECTPARTIALTALL: Select_PartialTall (); break; case ID_SELECTION_SELECTCOMPLETETALL: Select_CompleteTall (); break; case ID_SELECTION_SELECTTOUCHING: Select_Touching (); break; case ID_SELECTION_SELECTINSIDE: Select_Inside (); break; case ID_SELECTION_CSGSUBTRACT: CSG_Subtract (); break; case ID_SELECTION_MAKEHOLLOW: CSG_MakeHollow (); break; case ID_SELECTION_CLONE: Select_Clone (); break; case ID_SELECTION_DELETE: Select_Delete (); break; case ID_SELECTION_DESELECT: Select_Deselect (); break; case ID_SELECTION_MAKE_DETAIL: Select_MakeDetail (); break; case ID_SELECTION_MAKE_STRUCTURAL: Select_MakeStructural (); break; // // region menu // case ID_REGION_OFF: Map_RegionOff (); break; case ID_REGION_SETXY: Map_RegionXY (); break; case ID_REGION_SETTALLBRUSH: Map_RegionTallBrush (); break; case ID_REGION_SETBRUSH: Map_RegionBrush (); break; case ID_REGION_SETSELECTION: Map_RegionSelectedBrushes (); break; case IDMRU+1: case IDMRU+2: case IDMRU+3: case IDMRU+4: case IDMRU+5: case IDMRU+6: case IDMRU+7: case IDMRU+8: case IDMRU+9: DoMru(hWnd,LOWORD(wParam)); break; // // help menu // case ID_HELP_ABOUT: DoAbout(); break; default: return FALSE; } return TRUE; }
//////////////////////////////// // Find & Replace next instance void SearchReplaceEngine::ReplaceNext(bool DoReplace) { // Check if it's OK to go on if (!CanContinue) { OpenDialog(DoReplace); return; } wxArrayInt sels = grid->GetSelection(); // if selection has changed reset values if (sels[0] < curLine) { curLine = sels[0]; Modified = false; LastWasFind = true; pos = 0; matchLen = 0; replaceLen = 0; } // Setup int start = curLine; int nrows = grid->GetRows(); bool found = false; wxString *Text; size_t tempPos; int regFlags = wxRE_ADVANCED; if (!matchCase) { if (isReg) regFlags |= wxRE_ICASE; else LookFor.MakeLower(); } // Search for it while (!found) { Text = GetText(curLine,field); if (DoReplace && LastWasFind) tempPos = pos; else tempPos = pos+replaceLen; // RegExp if (isReg) { wxRegEx regex (LookFor,regFlags); if (regex.IsValid()) { if (regex.Matches(Text->Mid(tempPos))) { size_t match_start; regex.GetMatch(&match_start,&matchLen,0); pos = match_start + tempPos; //matchLen++; found = true; } } } // Normal else { wxString src = Text->Mid(tempPos); if (!matchCase) src.MakeLower(); pos = src.Find(LookFor); if (pos != -1) { pos += tempPos; found = true; matchLen = LookFor.Length(); } } // Didn't find, go to next line if (!found) { curLine++; pos = 0; matchLen = 0; replaceLen = 0; if (curLine == nrows) curLine = 0; if (curLine == start) break; } } // Found if (found) { grid->BeginBatch(); // If replacing if (DoReplace) { // Replace with regular expressions if (isReg) { wxString toReplace = Text->Mid(pos,matchLen); wxRegEx regex(LookFor,regFlags); regex.ReplaceFirst(&toReplace,ReplaceWith); *Text = Text->Left(pos) + toReplace + Text->Mid(pos+matchLen); replaceLen = toReplace.Length(); } // Normal replace else { *Text = Text->Left(pos) + ReplaceWith + Text->Mid(pos+matchLen); replaceLen = ReplaceWith.Length(); } // Update AssDialogue *cur = grid->GetDialogue(curLine); //cur->ParseASSTags(); cur->UpdateData(); // Commit grid->ass->FlagAsModified(); } else { replaceLen = matchLen; } // Select grid->SelectRow(curLine,false); grid->MakeCellVisible(curLine,0); if (field == 0) { grid->editBox->SetToLine(curLine); grid->editBox->TextEdit->SetSelectionU(pos,pos+replaceLen); } grid->EndBatch(); // Update video if (updateVideo) { grid->CommitChanges(); grid->SetVideoToSubs(true); } else if (DoReplace) Modified = true; // hAx to prevent double match on style/actor if (field != 0) replaceLen = 99999; } LastWasFind = !DoReplace; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); QCoreApplication::setOrganizationName("Fudeco Oy"); QCoreApplication::setOrganizationDomain("fudeco.com"); QCoreApplication::setApplicationName("Speed Freak"); helpDialog = NULL; accstart = NULL; routeSaveDialog = NULL; topResultDialog = NULL; settingsDialog = new SettingsDialog; connect(settingsDialog, SIGNAL(sendregistration()), this, SLOT(clientRegUserToServer())); connect(settingsDialog, SIGNAL(userNameChanged()), this, SLOT(clientUserLogin())); connect(settingsDialog, SIGNAL(logout()), this, SLOT(setUsernameToMainPanel())); connect(settingsDialog, SIGNAL(saveprofile()), this, SLOT(saveProfile())); httpClient = new HttpClient(this); connect(httpClient->myXmlreader, SIGNAL(receivedCategoryList()), this, SLOT(setCategoryCompoBox())); connect(httpClient->myXmlreader, SIGNAL(receivedTop10List()), this, SLOT(showTop10())); welcomeDialog = new WelcomeDialog; welcomeDialog->show(); this->setUsernameToMainPanel(); //Create icon for acceleration start button QIcon* icon = new QIcon(); icon->addFile(QString(":/new/prefix1/Graphics/Speedometer.png"), QSize(125,125), QIcon::Normal, QIcon::Off); icon->addFile(QString(":/new/prefix1/Graphics/Speedometer2.png"), QSize(125,125), QIcon::Normal, QIcon::On); //Acceleration start button customButtonAccelerate = new CustomButton(this,icon); delete icon; int buttons_x = 50,buttons_y = 165; customButtonAccelerate->setGeometry(buttons_x,buttons_y,130,130); connect(customButtonAccelerate, SIGNAL(OpenDialog()), this, SLOT(OpenAccStartDialog())); customButtonAccelerate->show(); //Create icon for route dialog button icon = new QIcon(); icon->addFile(QString(":/new/prefix1/Graphics/route.png"), QSize(125,125), QIcon::Normal, QIcon::Off); icon->addFile(QString(":/new/prefix1/Graphics/route_selected.png"), QSize(125,125), QIcon::Normal, QIcon::On); //Route dialog button customButtonRoute = new CustomButton(this,icon); delete icon; buttons_x += 140; customButtonRoute->setGeometry(buttons_x,buttons_y,130,130); connect(customButtonRoute, SIGNAL(OpenDialog()), this, SLOT(OpenRouteDialog())); customButtonRoute->show(); //Create icon for results dialog button icon = new QIcon(); icon->addFile(QString(":/new/prefix1/Graphics/trophy_gold.png"), QSize(125,125), QIcon::Normal, QIcon::Off); icon->addFile(QString(":/new/prefix1/Graphics/trophy_gold_selected.png"), QSize(125,125), QIcon::Normal, QIcon::On); //Results dialog button customButtonResults = new CustomButton(this,icon); delete icon; buttons_x += 140; customButtonResults->setGeometry(buttons_x,buttons_y,130,130); connect(customButtonResults, SIGNAL(OpenDialog()), this, SLOT(OpenResultDialog())); customButtonResults->show(); //Create icon for settings dialog button icon = new QIcon(); icon->addFile(QString(":/new/prefix1/Graphics/settings.png"), QSize(125,125), QIcon::Normal, QIcon::Off); icon->addFile(QString(":/new/prefix1/Graphics/settings_selected.png"), QSize(125,125), QIcon::Normal, QIcon::On); //Settings dialog button customButtonSettings = new CustomButton(this,icon); delete icon; buttons_x += 140; customButtonSettings->setGeometry(buttons_x,buttons_y,130,130); connect(customButtonSettings, SIGNAL(OpenDialog()), this, SLOT(OpenSettingsDialog())); customButtonSettings->show(); //Create icon for www page button icon = new QIcon(); icon->addFile(QString(":/new/prefix1/Graphics/applications_internet.png"), QSize(125,125), QIcon::Normal, QIcon::Off); icon->addFile(QString(":/new/prefix1/Graphics/applications_internet_selected.png"), QSize(125,125), QIcon::Normal, QIcon::On); //WWW page button customButtonWWW = new CustomButton(this,icon); delete icon; buttons_x += 140; customButtonWWW->setGeometry(buttons_x,buttons_y,130,130); connect(customButtonWWW, SIGNAL(OpenDialog()), this, SLOT(OpenWWWPage())); customButtonWWW->show(); //Create icon for help dialog button icon = new QIcon(); icon->addFile(QString(":/new/prefix1/Graphics/info.png"), QSize(105,105), QIcon::Normal, QIcon::Off); icon->addFile(QString(":/new/prefix1/Graphics/info_selected.png"), QSize(105,105), QIcon::Normal, QIcon::On); //Help dialog button customButtonHelp = new CustomButton(this,icon); delete icon; customButtonHelp->setGeometry(670,10,105,105); connect(customButtonHelp, SIGNAL(OpenDialog()), this, SLOT(OpenHelpDialog())); customButtonHelp->show(); }
void VizFrame::OnOpen(wxCommandEvent& WXUNUSED(event)) { // Open a dialog for just the .gml files wxFileDialog OpenDialog( this, wxT("Choose a file to open"), wxEmptyString, wxEmptyString, wxT("GML files (*.gml;*.trace)|*.gml;*.trace"), wxFD_OPEN, wxDefaultPosition); // If the user clicks the ok box, then present the image if (OpenDialog.ShowModal() == wxID_OK) { wxString path = OpenDialog.GetPath(); /* There are multiple ways of opening files. First a .trace file can be used to generate the graph files. Second a .gml extension can be used to open the graphs directly. The trace files have two different supported types. First, traces from the Ether system. Second, traces from a veratrace (Intel PIN) based system. */ if (path.EndsWith(wxT(".gml"))) { // Do the visualization. Check the return value here. StartVeraPane(); if (!veraPane->openFile(path)) { wxMessageBox( wxString::Format( wxT("Error loading GML file %s, invalid format. Is this actually a .gml file?"), path.c_str()) ); this->SetTitle(wxString::Format(wxT("%s"), wxT(__VERA_WINDOW_TITLE__))); this->SetStatusText(wxString::Format(wxT("Error loading %s"), path.c_str())); return; } else { this->SetStatusText(wxString::Format(wxT("Loaded %s"), path.c_str())); } } else if (path.EndsWith(wxT(".trace"))) { // If the file doesn't exist update title bar, status bar, display an error box if (!wxFileExists(path)) { wxMessageBox( wxString::Format( wxT("Error loading trace file %s"), path.c_str()) ); this->SetTitle(wxString::Format(wxT("%s"), wxT(__VERA_WINDOW_TITLE__))); this->SetStatusText(wxString::Format(wxT("Error loading %s"), path.c_str())); return; } // We need more information to open a trace file, so use that to open the file. traceWiz = new wxWizard(this, wxID_ANY, wxT("Process trace files"), wxNullBitmap, wxDefaultPosition, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER); if (traceWiz == NULL) { wxLogDebug(wxString::Format(wxT("Could not allocate memory: %s:%u"), __FILE__, __LINE__)); return; } page1 = new traceWizard(traceWiz); if (page1 == NULL) { wxLogDebug(wxString::Format(wxT("Could not allocate memory: %s:%u"), __FILE__, __LINE__)); return; } traceWiz->GetPageAreaSizer()->Add(page1); if (traceWiz->RunWizard(page1)) { // Make sure the check boxes are actually selected if (! (page1->m_genBblAddressesCheckBox->GetValue() || page1->m_genAllAddressesCheckBox->GetValue()) ) { wxMessageBox(wxT("You must select at least one\n" "address processing mode"), wxT("Trace Processing Error"), wxICON_ERROR); return; } wxString saveFile = page1->m_saveFile->GetValue(); // Check for invalid save file or duplicates if ( saveFile.StartsWith(wxT(NO_GML_FILE_SELECTED_TEXT)) ) { wxMessageBox(wxT("You must choose where to save\nthe graph data file."), wxT("Trace Processing Error"), wxICON_ERROR); return; } // Check for invalid exe files int answer = -1; bool doProcessExe = true; if ( page1->m_origExeFile->GetValue().StartsWith(wxT(NO_EXE_FILE_SELECTED_TEXT)) ) { // Ask the user if they want to generate a trace without the executable answer = wxMessageBox( wxT("Do you want to generate a trace without an executable?\n" "Certain features will be unavailable if one is not provided."), wxT("Missing .exe file"), wxCENTER | wxYES_NO); switch (answer) { case wxYES: // Nothing else is needed to do doProcessExe = false; break; case wxNO: // Return with nothing being done return; break; default: wxLogDebug(wxT("Strange error")); break; } } // Check to see if the GML file already exists bool doProcessBasicBlocks = page1->m_genBblAddressesCheckBox->GetValue(); bool doProcessAllBlocks = page1->m_genAllAddressesCheckBox->GetValue(); // Check for the basic blocks file if (doProcessBasicBlocks == true) { wxString fullFileName = prependFileName(saveFile, wxT("bbl-")); if (wxFileExists(fullFileName) ) { int answer = wxMessageBox( wxString::Format(wxT("File %s already exists, do you want to overwrite it?"), fullFileName.c_str()), wxT("File already exists"), wxCENTER | wxYES_NO ); switch (answer) { case wxNO: doProcessBasicBlocks = false; break; case wxYES: doProcessBasicBlocks = true; break; default: // Weirdness wxLogDebug(wxString::Format(wxT("Strange case reached at line %u in %s"), __LINE__, __FILE__ )); return; } } } if ( doProcessAllBlocks == true) { wxString fullFileName = prependFileName(saveFile, wxT("all-")); if (wxFileExists(fullFileName) ) { int answer = wxMessageBox( wxString::Format(wxT("File %s already exists, do you want to overwrite it?"), fullFileName.c_str()), wxT("File already exists"), wxCENTER | wxYES_NO ); switch (answer) { case wxNO: doProcessAllBlocks = false; break; case wxYES: doProcessAllBlocks = true; break; default: // Weirdness wxLogDebug(wxString::Format(wxT("Strange case reached at line %u in %s"), __LINE__, __FILE__ )); return; } } } if (doProcessAllBlocks == false && doProcessBasicBlocks == false) { this->SetStatusText(wxT("No files loaded")); return; } // Begin the actual processing dlgProgress = new wxProgressDialog(wxT("Processing trace file"), wxT("Processing the tracefile"), 100, this); if (dlgProgress == NULL) { wxLogDebug(wxString::Format(wxT("Could not allocate memory: %s:%u"), __FILE__, __LINE__)); return; } dlgProgress->Show(true); // Create a new thread to handle the actual trace generation tbThread = new threadTraceBuilder(path, (doProcessExe ? page1->m_origExeFile->GetValue() : wxString(wxT("")) ), // Empty string indicates processing trace file without a PE saveFile, doProcessBasicBlocks, doProcessAllBlocks, GRAPH_LAYOUT_LIBRARY_OGDF, this); if (tbThread == NULL) { wxLogDebug(wxString::Format(wxT("Could not allocate memory: %s:%u"), __FILE__, __LINE__)); return; } wxThreadError err = tbThread->Create(DEFAULT_THREAD_STACK_SIZE); if (wxTHREAD_NO_ERROR != err) { wxLogDebug(wxT("Error creating the trace builder thread %d"), err); return; } // Actually run the thread err = tbThread->Run(); if (wxTHREAD_NO_ERROR != err) { wxLogDebug(wxT("Error running the trace builder thread %d"), err); return; } } this->SetStatusText(wxString::Format(wxT("Processing %s..."), path.c_str())); traceWiz->Destroy(); } else { wxMessageBox( wxString::Format( wxT("Error loading file %s. File needs to have .gml or .trace as the file extension."), path.c_str()) ); this->SetTitle(wxString::Format(wxT("%s"), wxT(__VERA_WINDOW_TITLE__))); this->SetStatusText(wxString::Format(wxT("Error loading %s"), path.c_str())); return; } this->SetTitle(wxString::Format(wxT("%s - %s"), wxT(__VERA_WINDOW_TITLE__), path.c_str())); this->SetStatusText(wxString::Format(wxT("Loaded %s"), path.c_str())); } // Clean up the dialog OpenDialog.Destroy(); // Trigger a render event if (veraPane) veraPane->DrawAndRender(); }
void SearchReplaceEngine::ReplaceNext(bool DoReplace) { if (!CanContinue) { OpenDialog(DoReplace); return; } wxArrayInt sels = context->subsGrid->GetSelection(); int firstLine = 0; if (sels.Count() > 0) firstLine = sels[0]; // if selection has changed reset values if (firstLine != curLine) { curLine = firstLine; Modified = false; LastWasFind = true; pos = 0; matchLen = 0; replaceLen = 0; } // Setup int start = curLine; int nrows = context->subsGrid->GetRows(); bool found = false; size_t tempPos; int regFlags = wxRE_ADVANCED; if (!matchCase) { if (isReg) regFlags |= wxRE_ICASE; else LookFor.MakeLower(); } // Search for it boost::flyweight<wxString> *Text = nullptr; while (!found) { Text = get_text(context->subsGrid->GetDialogue(curLine), field); if (DoReplace && LastWasFind) tempPos = pos; else tempPos = pos+replaceLen; // RegExp if (isReg) { wxRegEx regex (LookFor,regFlags); if (regex.IsValid()) { if (regex.Matches(Text->get().Mid(tempPos))) { size_t match_start; regex.GetMatch(&match_start,&matchLen,0); pos = match_start + tempPos; found = true; } } } // Normal else { wxString src = Text->get().Mid(tempPos); if (!matchCase) src.MakeLower(); int textPos = src.Find(LookFor); if (textPos != -1) { pos = tempPos+textPos; found = true; matchLen = LookFor.Length(); } } // Didn't find, go to next line if (!found) { curLine++; pos = 0; matchLen = 0; replaceLen = 0; if (curLine == nrows) curLine = 0; if (curLine == start) break; } } // Found if (found) { // If replacing if (DoReplace) { // Replace with regular expressions if (isReg) { wxString toReplace = Text->get().Mid(pos,matchLen); wxRegEx regex(LookFor,regFlags); regex.ReplaceFirst(&toReplace,ReplaceWith); *Text = Text->get().Left(pos) + toReplace + Text->get().Mid(pos+matchLen); replaceLen = toReplace.Length(); } // Normal replace else { *Text = Text->get().Left(pos) + ReplaceWith + Text->get().Mid(pos+matchLen); replaceLen = ReplaceWith.Length(); } // Commit context->ass->Commit(_("replace"), AssFile::COMMIT_DIAG_TEXT); } else { replaceLen = matchLen; } // Select context->subsGrid->SelectRow(curLine,false); context->subsGrid->MakeCellVisible(curLine,0); if (field == 0) { context->selectionController->SetActiveLine(context->subsGrid->GetDialogue(curLine)); context->textSelectionController->SetSelection(pos, pos + replaceLen); } // Update video if (updateVideo) { cmd::call("video/jump/start", context); } else if (DoReplace) Modified = true; // hAx to prevent double match on style/actor if (field != 0) replaceLen = 99999; } LastWasFind = !DoReplace; }
LRESULT CMainWindow::DoCommand(int id, LPARAM lParam) { switch (id) { case ID_FILE_OPEN: { if (OpenDialog()) { picWindow1.SetPic(leftpicpath, _T(""), true); picWindow2.SetPic(rightpicpath, _T(""), false); if (bOverlap) { picWindow1.SetSecondPic(picWindow2.GetPic(), rightpictitle, rightpicpath); } else { picWindow1.SetSecondPic(); } RECT rect; GetClientRect(*this, &rect); PositionChildren(&rect); picWindow1.FitImageInWindow(); picWindow2.FitImageInWindow(); } } break; case ID_VIEW_IMAGEINFO: { bShowInfo = !bShowInfo; HMENU hMenu = GetMenu(*this); UINT uCheck = MF_BYCOMMAND; uCheck |= bShowInfo ? MF_CHECKED : MF_UNCHECKED; CheckMenuItem(hMenu, ID_VIEW_IMAGEINFO, uCheck); picWindow1.ShowInfo(bShowInfo); picWindow2.ShowInfo(bShowInfo); picWindow3.ShowInfo(bShowInfo); // change the state of the toolbar button TBBUTTONINFO tbi; tbi.cbSize = sizeof(TBBUTTONINFO); tbi.dwMask = TBIF_STATE; tbi.fsState = bShowInfo ? TBSTATE_CHECKED | TBSTATE_ENABLED : TBSTATE_ENABLED; SendMessage(hwndTB, TB_SETBUTTONINFO, ID_VIEW_IMAGEINFO, (LPARAM)&tbi); } break; case ID_VIEW_OVERLAPIMAGES: { bOverlap = !bOverlap; HMENU hMenu = GetMenu(*this); UINT uCheck = MF_BYCOMMAND; uCheck |= bOverlap ? MF_CHECKED : MF_UNCHECKED; CheckMenuItem(hMenu, ID_VIEW_OVERLAPIMAGES, uCheck); uCheck |= (m_BlendType == CPicWindow::BLEND_ALPHA) ? MF_CHECKED : MF_UNCHECKED; CheckMenuItem(hMenu, ID_VIEW_BLENDALPHA, uCheck); // change the state of the toolbar button TBBUTTONINFO tbi; tbi.cbSize = sizeof(TBBUTTONINFO); tbi.dwMask = TBIF_STATE; tbi.fsState = bOverlap ? TBSTATE_CHECKED | TBSTATE_ENABLED : TBSTATE_ENABLED; SendMessage(hwndTB, TB_SETBUTTONINFO, ID_VIEW_OVERLAPIMAGES, (LPARAM)&tbi); tbi.fsState = (m_BlendType == CPicWindow::BLEND_ALPHA) ? TBSTATE_CHECKED : 0; if (bOverlap) tbi.fsState |= TBSTATE_ENABLED; else tbi.fsState = 0; SendMessage(hwndTB, TB_SETBUTTONINFO, ID_VIEW_BLENDALPHA, (LPARAM)&tbi); if (bOverlap) tbi.fsState = 0; else tbi.fsState = bVertical ? TBSTATE_ENABLED | TBSTATE_CHECKED : TBSTATE_ENABLED; SendMessage(hwndTB, TB_SETBUTTONINFO, ID_VIEW_ARRANGEVERTICAL, (LPARAM)&tbi); if (bOverlap) { bLinkedPositions = true; picWindow1.LinkPositions(bLinkedPositions); picWindow2.LinkPositions(bLinkedPositions); tbi.fsState = TBSTATE_CHECKED; } else tbi.fsState = bLinkedPositions ? TBSTATE_ENABLED | TBSTATE_CHECKED : TBSTATE_ENABLED; SendMessage(hwndTB, TB_SETBUTTONINFO, ID_VIEW_LINKIMAGESTOGETHER, (LPARAM)&tbi); ShowWindow(picWindow2, bOverlap ? SW_HIDE : SW_SHOW); if (bOverlap) { picWindow1.StopTimer(); picWindow2.StopTimer(); picWindow1.SetSecondPic(picWindow2.GetPic(), rightpictitle, rightpicpath, picWindow2.GetHPos(), picWindow2.GetVPos()); picWindow1.SetBlendAlpha(m_BlendType, 0.5f); } else { picWindow1.SetSecondPic(); } picWindow1.SetOverlapMode(bOverlap); picWindow2.SetOverlapMode(bOverlap); RECT rect; GetClientRect(*this, &rect); PositionChildren(&rect); return 0; } break; case ID_VIEW_BLENDALPHA: { if (m_BlendType == CPicWindow::BLEND_ALPHA) m_BlendType = CPicWindow::BLEND_XOR; else m_BlendType = CPicWindow::BLEND_ALPHA; HMENU hMenu = GetMenu(*this); UINT uCheck = MF_BYCOMMAND; uCheck |= (m_BlendType == CPicWindow::BLEND_ALPHA) ? MF_CHECKED : MF_UNCHECKED; CheckMenuItem(hMenu, ID_VIEW_BLENDALPHA, uCheck); // change the state of the toolbar button TBBUTTONINFO tbi; tbi.cbSize = sizeof(TBBUTTONINFO); tbi.dwMask = TBIF_STATE; tbi.fsState = (m_BlendType == CPicWindow::BLEND_ALPHA) ? TBSTATE_CHECKED | TBSTATE_ENABLED : TBSTATE_ENABLED; SendMessage(hwndTB, TB_SETBUTTONINFO, ID_VIEW_BLENDALPHA, (LPARAM)&tbi); picWindow1.SetBlendAlpha(m_BlendType, picWindow1.GetBlendAlpha()); PositionChildren(); } break; case ID_VIEW_TRANSPARENTCOLOR: { static COLORREF customColors[16] = {0}; CHOOSECOLOR ccDlg; memset(&ccDlg, 0, sizeof(ccDlg)); ccDlg.lStructSize = sizeof(ccDlg); ccDlg.hwndOwner = m_hwnd; ccDlg.rgbResult = transparentColor; ccDlg.lpCustColors = customColors; ccDlg.Flags = CC_RGBINIT | CC_FULLOPEN; if(ChooseColor(&ccDlg)) { transparentColor = ccDlg.rgbResult; picWindow1.SetTransparentColor(transparentColor); picWindow2.SetTransparentColor(transparentColor); picWindow3.SetTransparentColor(transparentColor); // The color picker takes the focus and we don't get it back. ::SetFocus(picWindow1); } } break; case ID_VIEW_FITIMAGEWIDTHS: { bFitWidths = !bFitWidths; picWindow1.FitWidths(bFitWidths); picWindow2.FitWidths(bFitWidths); picWindow3.FitWidths(bFitWidths); HMENU hMenu = GetMenu(*this); UINT uCheck = MF_BYCOMMAND; uCheck |= bFitWidths ? MF_CHECKED : MF_UNCHECKED; CheckMenuItem(hMenu, ID_VIEW_FITIMAGEWIDTHS, uCheck); // change the state of the toolbar button TBBUTTONINFO tbi; tbi.cbSize = sizeof(TBBUTTONINFO); tbi.dwMask = TBIF_STATE; tbi.fsState = bFitWidths ? TBSTATE_CHECKED | TBSTATE_ENABLED : TBSTATE_ENABLED; SendMessage(hwndTB, TB_SETBUTTONINFO, ID_VIEW_FITIMAGEWIDTHS, (LPARAM)&tbi); } break; case ID_VIEW_FITIMAGEHEIGHTS: { bFitHeights = !bFitHeights; picWindow1.FitHeights(bFitHeights); picWindow2.FitHeights(bFitHeights); picWindow3.FitHeights(bFitHeights); HMENU hMenu = GetMenu(*this); UINT uCheck = MF_BYCOMMAND; uCheck |= bFitHeights ? MF_CHECKED : MF_UNCHECKED; CheckMenuItem(hMenu, ID_VIEW_FITIMAGEHEIGHTS, uCheck); // change the state of the toolbar button TBBUTTONINFO tbi; tbi.cbSize = sizeof(TBBUTTONINFO); tbi.dwMask = TBIF_STATE; tbi.fsState = bFitHeights ? TBSTATE_CHECKED | TBSTATE_ENABLED : TBSTATE_ENABLED; SendMessage(hwndTB, TB_SETBUTTONINFO, ID_VIEW_FITIMAGEHEIGHTS, (LPARAM)&tbi); } break; case ID_VIEW_LINKIMAGESTOGETHER: { bLinkedPositions = !bLinkedPositions; picWindow1.LinkPositions(bLinkedPositions); picWindow2.LinkPositions(bLinkedPositions); picWindow3.LinkPositions(bLinkedPositions); HMENU hMenu = GetMenu(*this); UINT uCheck = MF_BYCOMMAND; uCheck |= bLinkedPositions ? MF_CHECKED : MF_UNCHECKED; CheckMenuItem(hMenu, ID_VIEW_LINKIMAGESTOGETHER, uCheck); // change the state of the toolbar button TBBUTTONINFO tbi; tbi.cbSize = sizeof(TBBUTTONINFO); tbi.dwMask = TBIF_STATE; tbi.fsState = bLinkedPositions ? TBSTATE_CHECKED | TBSTATE_ENABLED : TBSTATE_ENABLED; SendMessage(hwndTB, TB_SETBUTTONINFO, ID_VIEW_LINKIMAGESTOGETHER, (LPARAM)&tbi); } break; case ID_VIEW_ALPHA0: picWindow1.SetBlendAlpha(m_BlendType, 0.0f); break; case ID_VIEW_ALPHA255: picWindow1.SetBlendAlpha(m_BlendType, 1.0f); break; case ID_VIEW_ALPHA127: picWindow1.SetBlendAlpha(m_BlendType, 0.5f); break; case ID_VIEW_ALPHATOGGLE: picWindow1.ToggleAlpha(); break; case ID_VIEW_FITIMAGESINWINDOW: { picWindow1.FitImageInWindow(); picWindow2.FitImageInWindow(); picWindow3.FitImageInWindow(); } break; case ID_VIEW_ORININALSIZE: { picWindow1.SetZoom(100, false); picWindow2.SetZoom(100, false); picWindow3.SetZoom(100, false); picWindow1.CenterImage(); picWindow2.CenterImage(); picWindow3.CenterImage(); } break; case ID_VIEW_ZOOMIN: { picWindow1.Zoom(true, false); if ((!(bFitWidths || bFitHeights))&&(!bOverlap)) { picWindow2.Zoom(true, false); picWindow3.Zoom(true, false); } } break; case ID_VIEW_ZOOMOUT: { picWindow1.Zoom(false, false); if ((!(bFitWidths || bFitHeights))&&(!bOverlap)) { picWindow2.Zoom(false, false); picWindow3.Zoom(false, false); } } break; case ID_VIEW_ARRANGEVERTICAL: { bVertical = !bVertical; RECT rect; GetClientRect(*this, &rect); if (bVertical) { RECT tbRect; GetWindowRect(hwndTB, &tbRect); LONG tbHeight = tbRect.bottom-tbRect.top-1; if (selectionPaths.size() != 3) { nSplitterPos = (rect.bottom-rect.top)/2+tbHeight; nSplitterPos2 = 0; } else { nSplitterPos = (rect.bottom-rect.top)/3+tbHeight; nSplitterPos2 = (rect.bottom-rect.top)*2/3+tbHeight; } } else { if (selectionPaths.size() != 3) { nSplitterPos = (rect.right-rect.left)/2; nSplitterPos2 = 0; } else { nSplitterPos = (rect.right-rect.left)/3; nSplitterPos2 = (rect.right-rect.left)*2/3; } } HMENU hMenu = GetMenu(*this); UINT uCheck = MF_BYCOMMAND; uCheck |= bVertical ? MF_CHECKED : MF_UNCHECKED; CheckMenuItem(hMenu, ID_VIEW_ARRANGEVERTICAL, uCheck); // change the state of the toolbar button TBBUTTONINFO tbi; tbi.cbSize = sizeof(TBBUTTONINFO); tbi.dwMask = TBIF_STATE; tbi.fsState = bVertical ? TBSTATE_CHECKED | TBSTATE_ENABLED : TBSTATE_ENABLED; SendMessage(hwndTB, TB_SETBUTTONINFO, ID_VIEW_ARRANGEVERTICAL, (LPARAM)&tbi); PositionChildren(&rect); } break; case ID_ABOUT: { CAboutDlg dlg(*this); dlg.DoModal(hInst, IDD_ABOUT, *this); } break; case SELECTBUTTON_ID: { HWND hSource = (HWND)lParam; if (picWindow1 == hSource) { if (!selectionResult.empty()) CopyFile(selectionPaths[FileTypeMine].c_str(), selectionResult.c_str(), FALSE); PostQuitMessage(FileTypeMine); } if (picWindow2 == hSource) { if (!selectionResult.empty()) CopyFile(selectionPaths[FileTypeBase].c_str(), selectionResult.c_str(), FALSE); PostQuitMessage(FileTypeBase); } if (picWindow3 == hSource) { if (!selectionResult.empty()) CopyFile(selectionPaths[FileTypeTheirs].c_str(), selectionResult.c_str(), FALSE); PostQuitMessage(FileTypeTheirs); } } break; case IDM_EXIT: ::PostQuitMessage(0); return 0; break; default: break; }; return 1; }
EAppReturnType::Type FFaceFXComboChoiceWidget::Create(const FText& InTitle, const FText& InMessage, const TArray<FString>& Options, TSharedPtr<FFaceFXComboChoiceWidget>& OutResult, bool ShowAsModal) { auto ResultWidget = SAssignNew(OutResult, FFaceFXComboChoiceWidget).Options(Options).Message(InMessage); return ResultWidget->OpenDialog(InTitle, ShowAsModal); }