//************************************************************************************* void CBCGPKeyMapDlg::OnDestroy() { //---------------------------------- // Save window position and size: //---------------------------------- if (GetWorkspace () != NULL) { CRect rectPosition; GetWindowRect (rectPosition); CBCGPRegistrySP regSP; CBCGPRegistry& reg = regSP.Create (FALSE, FALSE); if (reg.CreateKey (GetWorkspace ()->GetRegSectionPath (strWindowPlacementRegSection))) { reg.Write (strRectKey, rectPosition); } } CBCGPDialog::OnDestroy(); }
void DataSetValues::ShowView() { if (m_view) { m_view->raise(); } else { m_view = new DataSetValuesView(this); GetWorkspace()->AddDockWidget(m_view); connect(m_view,SIGNAL(destroyed()),this, SLOT(OnViewClosed())); m_view->setFocus(); } }
Projects::Project* ToolCommandString::GetActiveProject() { Projects::Workspace* pWorkspace = GetWorkspace(); if (pWorkspace != NULL) { Projects::Project* pProject = pWorkspace->GetActiveProject(); if (pProject != NULL && pProject->Exists()) return pProject; } return NULL; }
wxArrayString PluginManager::GetProjectCompileFlags(const wxString& projectName, bool isCppFile) { if(IsWorkspaceOpen() == false) return wxArrayString(); wxArrayString args; // Next apppend the user include paths wxString errMsg; // First, we need to find the currently active workspace configuration BuildMatrixPtr matrix = GetWorkspace()->GetBuildMatrix(); if(!matrix) { return wxArrayString(); } wxString workspaceSelConf = matrix->GetSelectedConfigurationName(); // Now that we got the selected workspace configuration, extract the related project configuration ProjectPtr proj = GetWorkspace()->FindProjectByName(projectName, errMsg); if(!proj) { return args; } wxString projectSelConf = matrix->GetProjectSelectedConf(workspaceSelConf, proj->GetName()); BuildConfigPtr dependProjbldConf = GetWorkspace()->GetProjBuildConf(proj->GetName(), projectSelConf); if(dependProjbldConf && dependProjbldConf->IsCustomBuild() == false) { // Get the include paths and add them wxString projectIncludePaths = dependProjbldConf->GetIncludePath(); wxArrayString projectIncludePathsArr = wxStringTokenize(projectIncludePaths, wxT(";"), wxTOKEN_STRTOK); for(size_t i = 0; i < projectIncludePathsArr.GetCount(); i++) { args.Add(wxString::Format(wxT("-I%s"), projectIncludePathsArr[i].c_str())); } // get the compiler options and add them wxString projectCompileOptions = dependProjbldConf->GetCompileOptions(); wxArrayString projectCompileOptionsArr = wxStringTokenize(projectCompileOptions, wxT(";"), wxTOKEN_STRTOK); for(size_t i = 0; i < projectCompileOptionsArr.GetCount(); i++) { wxString cmpOption(projectCompileOptionsArr.Item(i)); cmpOption.Trim().Trim(false); wxString tmp; // Expand backticks / $(shell ...) syntax supported by codelite if(cmpOption.StartsWith(wxT("$(shell "), &tmp) || cmpOption.StartsWith(wxT("`"), &tmp)) { cmpOption = tmp; tmp.Clear(); if(cmpOption.EndsWith(wxT(")"), &tmp) || cmpOption.EndsWith(wxT("`"), &tmp)) { cmpOption = tmp; } if(m_backticks.find(cmpOption) == m_backticks.end()) { // Expand the backticks into their value wxArrayString outArr; // Apply the environment before executing the command EnvSetter setter(EnvironmentConfig::Instance(), NULL, projectName); ProcUtils::SafeExecuteCommand(cmpOption, outArr); wxString expandedValue; for(size_t j = 0; j < outArr.size(); j++) { expandedValue << outArr.Item(j) << wxT(" "); } m_backticks[cmpOption] = expandedValue; cmpOption = expandedValue; } else { cmpOption = m_backticks.find(cmpOption)->second; } } args.Add(cmpOption); } // get the compiler preprocessor and add them as well wxString projectPreps = dependProjbldConf->GetPreprocessor(); wxArrayString projectPrepsArr = wxStringTokenize(projectPreps, wxT(";"), wxTOKEN_STRTOK); for(size_t i = 0; i < projectPrepsArr.GetCount(); i++) { args.Add(wxString::Format(wxT("-D%s"), projectPrepsArr[i].c_str())); } } return args; }
bool ProjectManager::SaveWorkspaceAs(const wxString& filename) { return GetWorkspace()->SaveAs(filename); }
bool ProjectManager::SaveWorkspace() { return GetWorkspace()->Save(); }
void Hotlist::OnChange(OpWidget *widget, BOOL changed_by_mouse) { if (widget == m_selector) { INT32 selected = m_selector->GetSelected(); if (selected < GetPanelCount()) { for (INT32 i = 0; i < GetPanelCount(); i++) { HotlistPanel *panel = GetPanel(i); panel->SetVisibility(i == selected); // if selector does not have focus, restore focus to previous focuses widget in this panel // this is what the user would desire, right? if (i == selected && (changed_by_mouse || !m_selector->IsFocused())) { panel->RestoreFocus(FOCUS_REASON_OTHER); } } if (selected == -1) { if (IsCollapsableToSmall()) { SetCollapse(COLLAPSE_SMALL, TRUE); if (GetWorkspace() && GetWorkspace()->GetActiveDesktopWindow()) { GetWorkspace()->GetActiveDesktopWindow()->RestoreFocus(FOCUS_REASON_OTHER); } } else { m_selector->SetSelected(ReadActiveTab(), TRUE, TRUE); } } else { SetCollapse(GetCollapse() == COLLAPSE_SMALL ? COLLAPSE_NORMAL : GetCollapse(), TRUE); SaveActiveTab(m_selector->GetSelected()); } g_input_manager->UpdateAllInputStates(); if (GetParentDesktopWindow()) GetParentDesktopWindow()->OnChange(this, changed_by_mouse); } } else { INT32 count = GetPanelCount(); for (INT32 i = 0; i < count; i++) { HotlistPanel* panel = GetPanel(i); if (widget == panel) { OpString text; panel->GetPanelText(text, PANEL_TEXT_LABEL); OpButton* button = (OpButton*) m_selector->GetWidget(i); button->SetText(text.CStr()); button->GetForegroundSkin()->SetImage(panel->GetPanelImage()); button->SetAttention(panel->GetPanelAttention()); if (GetParentDesktopWindow() && i == m_selector->GetSelected()) GetParentDesktopWindow()->OnChange(this, changed_by_mouse); return; } } } }
BOOL CBCGPKeyMapDlg::OnInitDialog() { CBCGPDialog::OnInitDialog(); if (AfxGetMainWnd () != NULL && (AfxGetMainWnd ()->GetExStyle () & WS_EX_LAYOUTRTL)) { ModifyStyleEx (0, WS_EX_LAYOUTRTL); } { CBCGPLocalResource locaRes; //----------------- // Set dialog icon: //----------------- SetIcon ((HICON) ::LoadImage ( AfxGetResourceHandle (), MAKEINTRESOURCE (IDI_BCGBARRES_HELP), IMAGE_ICON, ::GetSystemMetrics (SM_CXSMICON), ::GetSystemMetrics (SM_CYSMICON), LR_SHARED), FALSE); //--------------- // Setup buttons: //--------------- m_ButtonPrint.m_nFlatStyle = CBCGPButton::BUTTONSTYLE_FLAT; m_ButtonCopy.m_nFlatStyle = CBCGPButton::BUTTONSTYLE_FLAT; CString strTT; if (m_bEnablePrint) { m_ButtonPrint.SetImage (globalData.Is32BitIcons () ? IDB_BCGBARRES_PRINT32 : IDB_BCGBARRES_PRINT, NULL); m_ButtonPrint.GetWindowText (strTT); m_ButtonPrint.SetWindowText (_T("")); m_ButtonPrint.SetTooltip (strTT); m_ButtonPrint.SizeToContent (); m_ButtonPrint.m_bDrawFocus = FALSE; } else { m_ButtonPrint.ShowWindow (SW_HIDE); } m_ButtonCopy.SetImage (globalData.Is32BitIcons () ? IDB_BCGBARRES_COPY32 : IDB_BCGBARRES_COPY, NULL); m_ButtonCopy.GetWindowText (strTT); m_ButtonCopy.SetWindowText (_T("")); m_ButtonCopy.SetTooltip (strTT); m_ButtonCopy.SizeToContent (); m_ButtonCopy.m_bDrawFocus = FALSE; //------------- // Add columns: //------------- OnSetColumns (); SetColumnsWidth (); } //------------------------------------------------------------- // Find all application document templates and fill accelerator // tables combobox by document template data: //------------------------------------------------------------- CDocManager* pDocManager = AfxGetApp ()->m_pDocManager; if (pDocManager != NULL) { //--------------------------------------- // Walk all templates in the application: //--------------------------------------- for (POSITION pos = pDocManager->GetFirstDocTemplatePosition (); pos != NULL;) { CBCGPMultiDocTemplate* pTemplate = (CBCGPMultiDocTemplate*) pDocManager->GetNextDocTemplate (pos); ASSERT_VALID (pTemplate); ASSERT_KINDOF (CDocTemplate, pTemplate); //----------------------------------------------------- // We are interessing CBCGPMultiDocTemplate objects with // the shared menu only.... //----------------------------------------------------- if (!pTemplate->IsKindOf (RUNTIME_CLASS (CMultiDocTemplate)) || pTemplate->m_hAccelTable == NULL) { continue; } CString strName; pTemplate->GetDocString (strName, CDocTemplate::fileNewName); int iIndex = m_wndViewTypeList.AddString (strName); m_wndViewTypeList.SetItemData (iIndex, (DWORD_PTR) pTemplate); } } //-------------------------- // Add a default application: //-------------------------- CFrameWnd* pWndMain = DYNAMIC_DOWNCAST (CFrameWnd, m_pWndParentFrame); if (pWndMain != NULL && pWndMain->m_hAccelTable != NULL) { CBCGPLocalResource locaRes; CString strName; strName.LoadString (IDS_BCGBARRES_DEFAULT_VIEW); int iIndex = m_wndViewTypeList.AddString (strName); m_wndViewTypeList.SetItemData (iIndex, (DWORD_PTR) NULL); m_wndViewTypeList.SetCurSel (iIndex); OnSelchangeViewType(); } m_KeymapList.SetExtendedStyle (LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES); OnSelchangeViewType (); //--------------------------------- // Initialize commands by category: //--------------------------------- if (m_pWndRibbonBar == NULL) { m_pDlgCust = new CBCGPToolbarCustomize(m_pWndParentFrame, TRUE); m_pDlgCust->EnableUserDefinedToolbars(); m_pDlgCust->FillCategoriesComboBox (m_wndCategoryList); } #ifndef BCGP_EXCLUDE_RIBBON else { CBCGPRibbonCategory* pMainCategory = m_pWndRibbonBar->GetMainCategory (); if (pMainCategory != NULL) { ASSERT_VALID (pMainCategory); m_wndCategoryList.AddString (pMainCategory->GetName ()); } for (int i = 0; i < m_pWndRibbonBar->GetCategoryCount (); i++) { m_wndCategoryList.AddString(m_pWndRibbonBar->GetCategory (i)->GetName ()); } } #endif m_wndCategoryList.SetCurSel (0); OnSelchangeCategory (); //---------------------------------- // Restore window position and size: //---------------------------------- if (GetWorkspace () != NULL) { CBCGPRegistrySP regSP; CBCGPRegistry& reg = regSP.Create (FALSE, TRUE); CRect rectPosition; if (reg.Open (GetWorkspace ()->GetRegSectionPath (strWindowPlacementRegSection)) && reg.Read (strRectKey, rectPosition)) { MoveWindow (rectPosition); } } return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void DataSetValues::OnViewClosed() { m_view = NULL; //remove ourself GetWorkspace()->DeleteInstance(this->GetAutoId()); }
bool DataSetValues::InteractiveFocus() { GetWorkspace()->WidgetAlert(m_view); return true; }
void ToolCommandString::OnFormatChar(TCHAR thechar) { switch (thechar) { case _T('f'): if (pChild) m_string += pChild->GetFileName(FN_FILE); break; case _T('d'): { if (pChild) { CPathName pn(pChild->GetFileName(FN_PATH)); if (reversePathSeps) pn.SetForwardSlashes(); m_string += pn; } } break; case _T('n'): if (pChild) m_string += pChild->GetFileName(FN_FILEPART); break; case _T('l'): if (pChild) { _itot(pChild->GetPosition(EP_LINE), itosbuf, 10); m_string += itosbuf; } break; case _T('c'): if (pChild) { _itot(pChild->GetPosition(EP_COL), itosbuf, 10); m_string += itosbuf; } break; case _T('w'): if (pChild) { CA2CT word(pChild->GetTextView()->GetCurrentWord().c_str()); m_string += word; } break; // current project file. case _T('p'): { Projects::Workspace* pWorkspace = g_Context.m_frame->GetActiveWorkspace(); if (pWorkspace != NULL) { Projects::Project* pProject = pWorkspace->GetActiveProject(); if (pProject != NULL && pProject->Exists()) { CFileName fn(pProject->GetFileName()); if (reversePathSeps) fn.SetForwardSlashes(); m_string += fn; } } } break; // current project group (workspace) file. case _T('g'): { Projects::Workspace* pWorkspace = GetWorkspace(); if (pWorkspace != NULL && pWorkspace->CanSave()) { CFileName fn(pWorkspace->GetFileName()); if (reversePathSeps) fn.SetForwardSlashes(); m_string += fn; } } break; case _T('?'): { CInputDialog dlg(_T("Tool Parameters"), _T("Parameters:")); if ( dlg.DoModal() == IDOK ) { m_string += dlg.GetInput(); } else { throw FormatStringBuilderException(); } } break; } }
void ToolCommandString::OnFormatKey(LPCTSTR key) { if (MATCH(_T("ProjectPath"))) { Projects::Project* pP = GetActiveProject(); if (pP) { CFileName fn(pP->GetFileName()); if (reversePathSeps) fn.SetForwardSlashes(); m_string += fn.GetPath(); } } else if (MATCH(_T("ProjectGroupPath"))) { Projects::Workspace* pWorkspace = GetWorkspace(); if (pWorkspace != NULL && pWorkspace->CanSave()) { CFileName fn(pWorkspace->GetFileName()); if (reversePathSeps) fn.SetForwardSlashes(); m_string += fn.GetPath(); } } else if (MATCH_START(_T("ProjectProp:"))) { Projects::Project* pP = GetActiveProject(); if (!pP) return; Projects::ProjectTemplate* pTemplate = pP->GetTemplate(); if (!pTemplate) return; boost::xpressive::tsregex re = boost::xpressive::tsregex::compile(L"ProjectProp:(?P<group>[-_a-zA-Z0-9]+)\\.(?P<cat>[-_a-zA-Z0-9]+)\\.(?P<val>[-_a-zA-Z0-9]+)"); boost::xpressive::tsmatch match; tstring prop(key); if (boost::xpressive::regex_match(prop, match, re)) { // Extract the named matches from the RE, noting if there was a line or column. tstring group(match[_T("group")]); tstring cat(match[_T("cat")]); tstring val(match[_T("val")]); if (group.empty() || cat.empty() || val.empty()) { return; } LPCTSTR retval = pP->GetUserData().Lookup(pTemplate->GetNamespace(), group.c_str(), cat.c_str(), val.c_str(), _T("")); if (retval != NULL) { m_string += retval; } } } else if (MATCH_START(_T("FileProp:"))) { Projects::Project* pP = GetActiveProject(); if (!pP) return; Projects::ProjectTemplate* pTemplate = pP->GetTemplate(); if (!pTemplate) return; if (!pChild) return; Projects::File* pFileObj = pP->FindFile(pChild->GetFileName().c_str()); if (!pFileObj) return; boost::xpressive::tsregex re = boost::xpressive::tsregex::compile(_T("FileProp:(?P<group>[-_a-zA-Z0-9]+)\\.(?P<cat>[-_a-zA-Z0-9]+)\\.(?P<val>[-_a-zA-Z0-9]+)")); boost::xpressive::tsmatch match; tstring prop(key); if (boost::xpressive::regex_match(prop, match, re)) { // Extract the named matches from the RE, noting if there was a line or column. tstring group(match[_T("group")]); tstring cat(match[_T("cat")]); tstring val(match[_T("val")]); if (group.empty() || cat.empty() || val.empty()) { return; } LPCTSTR retval = pFileObj->GetUserData().Lookup(pTemplate->GetNamespace(), group.c_str(), cat.c_str(), val.c_str(), _T("")); if (retval != NULL) { m_string += retval; } } } else if (MATCH(_T("ProjectName"))) { Projects::Project *pP = GetActiveProject(); if (pP) { m_string += pP->GetName(); } } else if (MATCH(_T("ProjectGroupName"))) { Projects::Workspace *pW = GetWorkspace(); if (pW != NULL) { m_string += pW->GetName(); } } else if (MATCH(_T("PNPath"))) { tstring pn; OPTIONS->GetPNPath(pn); m_string += pn; } else { tstring s = _T("Unknown constant: $("); s += key; s += _T(")."); g_Context.m_frame->SetStatusText(s.c_str()); } }
void OpHotlistView::HandleMouseEvent(OpTreeView* widget, HotlistModelItem* item, INT32 pos, MouseButton button, BOOL down, UINT8 nclicks) { BOOL shift = GetWidgetContainer()->GetView()->GetShiftKeys() & SHIFTKEY_SHIFT; BOOL ctrl = GetWidgetContainer()->GetView()->GetShiftKeys() & SHIFTKEY_CTRL; // single or double click mode BOOL click_state_ok = (IsSingleClick() && !down && nclicks == 1 && !shift) || nclicks == 2; if (IsContacts()) { ViewSelectedContactMail(click_state_ok, ctrl); } else if (IsNotes()) { if (nclicks == 2) { if (item->GetUrl().HasContent()) { g_application->GoToPage(item->GetUrl().CStr()); } else if (GetWorkspace() && GetWorkspace()->GetActiveDesktopWindow() && GetWorkspace()->GetActiveDesktopWindow()->GetRecentKeyboardChildInputContext()) { if(!item->GetIsTrashFolder()) { OpInputContext* input_context = GetWorkspace()->GetActiveDesktopWindow()->GetRecentKeyboardChildInputContext(); OpString name; name.Set(item->GetName()); if (strcmp(input_context->GetInputContextName(),"Edit Widget")==0) { OpInputAction action(OpInputAction::ACTION_INSERT); action.SetActionDataString(name.CStr()); input_context->OnInputAction(&action); } else if (item->IsNote()) { OpString empty; OpString name; name.Set(item->GetName()); MailTo mailto; mailto.Init(empty, empty, empty, empty, name); // set mail body (message) to content of name MailCompose::ComposeMail(mailto); return; } input_context->SetFocus(FOCUS_REASON_OTHER); } } else if (item->IsNote()) { OpString empty, name; name.Set(item->GetName()); MailTo mailto; mailto.Init(empty, empty, empty, empty, name); // set mail body (message) to content of name MailCompose::ComposeMail(mailto); } } } #ifdef WEBSERVER_SUPPORT else if (IsUniteServices() && item->IsUniteService() && nclicks == 2 ) { static_cast<UniteServiceModelItem*>(item)->GoToPublicPage(); } else if (IsUniteServices() && item->IsUniteService()) // not nclicks == 2 { if(widget->GetType() == WIDGET_TYPE_TREEVIEW && pos != -1 && ((OpTreeView*)widget)->IsHoveringAssociatedImageItem(pos)) { OpInputAction action(OpInputAction::ACTION_EDIT_PROPERTIES); INT32 state = g_input_manager->GetActionState(&action, this); if (state & OpInputAction::STATE_ENABLED) { // Show dialog g_input_manager->InvokeAction(OpInputAction::ACTION_EDIT_PROPERTIES, 1); } } } #endif }