bool dlgAirspaceShowModal(bool coloredit){ colormode = coloredit; WndForm *wf = dlgLoadFromXML(CallBackTable, ScreenLandscape ? IDR_XML_AIRSPACE_L : IDR_XML_AIRSPACE_P); if (!wf) return false; WndListFrame* wAirspaceList = (WndListFrame*)wf->FindByName(TEXT("frmAirspaceList")); LKASSERT(wAirspaceList!=NULL); wAirspaceList->SetBorderKind(BORDERLEFT); wAirspaceList->SetEnterCallback(OnAirspaceListEnter); WndOwnerDrawFrame* wAirspaceListEntry = (WndOwnerDrawFrame*)wf->FindByName(TEXT("frmAirspaceListEntry")); if(wAirspaceListEntry) { wAirspaceListEntry->SetCanFocus(true); } UpdateList(wAirspaceList); changed = false; wf->ShowModal(); delete wf; return changed; }
static void NextPage(WndForm* pForm, int Step){ if(!pForm) { return; } TCHAR buffer[200]; page += Step; if (page>=nLists) { page=0; } if (page<0) { page= nLists-1; } WndOwnerDrawFrame* wDetailsEntry = (WndOwnerDrawFrame*)pForm->FindByName(TEXT("frmDetailsEntry")); if(!wDetailsEntry) { return; } LKWindowSurface Surface(*wDetailsEntry); Surface.SelectObject(wDetailsEntry->GetFont()); aTextLine.update(Surface, wDetailsEntry->GetWidth(), ChecklistText[page]); switch(nLists) { case 0: _stprintf(buffer, _T("%s %s"),NoteModeTitle,MsgToken(1750)); // empty break; case 1: _stprintf(buffer, _T("%s"),NoteModeTitle); break; default: _stprintf(buffer, _T("%s %d/%d"),NoteModeTitle,page+1,nLists); break; } if (ChecklistTitle[page] && (_tcslen(ChecklistTitle[page])>0) && (_tcslen(ChecklistTitle[page])<60)) { _tcscat(buffer, TEXT(": ")); _tcscat(buffer, ChecklistTitle[page]); } pForm->SetCaption(buffer); WndListFrame* wDetails = (WndListFrame*)pForm->FindByName(TEXT("frmDetails")); if(wDetails) { wDetails->ResetList(); wDetails->Redraw(); } }
void Move(const PixelRect &rc) override { const Layout layout(rc, waypoint); if (allow_navigation) goto_button.Move(layout.goto_button); if (!images.empty()) { magnify_button.Move(layout.magnify_button); shrink_button.Move(layout.shrink_button); } if (allow_navigation) { previous_button.Move(layout.previous_button); next_button.Move(layout.next_button); } close_button.Move(layout.close_button); info_dock.Move(layout.main); details_panel.Move(layout.main); details_text.Move(layout.details_text); #ifdef HAVE_RUN_FILE if (!waypoint.files_external.empty()) file_list.Move(layout.file_list); #endif commands_dock.Move(layout.main); if (!images.empty()) image_window.Move(layout.main); }
void Show(const PixelRect &rc) override { const Layout layout(rc, *waypoint); if (task_manager != nullptr) goto_button.MoveAndShow(layout.goto_button); if (!images.empty()) { magnify_button.MoveAndShow(layout.magnify_button); shrink_button.MoveAndShow(layout.shrink_button); } previous_button.MoveAndShow(layout.previous_button); next_button.MoveAndShow(layout.next_button); close_button.MoveAndShow(layout.close_button); info_dock.Move(layout.main); details_panel.Move(layout.main); details_text.Move(layout.details_text); #ifdef HAVE_RUN_FILE if (!waypoint->files_external.empty()) file_list.Move(layout.file_list); #endif commands_dock.Move(layout.main); if (!images.empty()) image_window.Move(layout.main); UpdatePage(); }
void Show() { TCHAR filename[MAX_PATH]; const TCHAR *resName = NULL; if (!ScreenLandscape) { LocalPathS(filename, TEXT("dlgBluetooth_L.xml")); resName = TEXT("IDR_XML_BLUETOOTH_L"); } else { LocalPathS(filename, TEXT("dlgBluetooth.xml")); resName = TEXT("IDR_XML_BLUETOOTH"); } wfBth = dlgLoadFromXML(CallBackTable, filename, resName); if (wfBth) { WndListFrame* BthList = (WndListFrame*) wfBth->FindByName(TEXT("frmBthList")); if (BthList) { BthList->SetBorderKind(BORDERLEFT | BORDERTOP | BORDERRIGHT | BORDERBOTTOM); BthList->SetWidth(wfBth->GetWidth() - BthList->GetLeft() - IBLSCALE(4)); // Bug : we need ClientHeight, but Cleint Rect is Calculated by OnPaint // BthList->SetHeight(wfBth->GetHeight() - BthList->GetTop() - 2); if (BthList->ScrollbarWidth == -1) { BthList->ScrollbarWidth = (int) (SCROLLBARWIDTH_INITIAL * ScreenDScale); } WndOwnerDrawFrame* BthListEntry = (WndOwnerDrawFrame*) wfBth->FindByName(TEXT("frmBthListEntry")); if (BthListEntry) { BthListEntry->SetCanFocus(true); BthListEntry->SetWidth(BthList->GetWidth() - BthList->ScrollbarWidth - 5); } BthList->ResetList(); BthList->Redraw(); } if (wfBth->ShowModal()) { CBtHandler * pBtHandler = CBtHandler::Get(); if (pBtHandler) { pBtHandler->ClearDevices(); pBtHandler->FillDevices(); } RefreshComPortList(); } delete wfBth; wfBth = NULL; } }
void dlgIgcFileShowModal() { TCHAR filename[MAX_PATH]; const TCHAR *resName = NULL; if (!ScreenLandscape) { LocalPathS(filename, TEXT("dlgIgcFile.xml")); resName = TEXT("IDR_XML_IGCFILE"); } else { LocalPathS(filename, TEXT("dlgIgcFile_L.xml")); resName = TEXT("IDR_XML_IGCFILE_L"); } wfDlg = dlgLoadFromXML(DlgIgcFile::CallBackTable, filename, resName); if (wfDlg) { WndListFrame* wndFileList = (WndListFrame*) wfDlg->FindByName(TEXT("frmIgcFileList")); if (wndFileList) { wndFileList->SetBorderKind(BORDERLEFT | BORDERTOP | BORDERRIGHT | BORDERBOTTOM); wndFileList->SetWidth(wfDlg->GetWidth() - wndFileList->GetLeft() - IBLSCALE(4)); // Bug : we need ClientHeight, but Cleint Rect is Calculated by OnPaint // wndFileList->SetHeight(wfDlg->GetHeight() - wndFileList->GetTop() - 2); if (wndFileList->ScrollbarWidth == -1) { wndFileList->ScrollbarWidth = (int) (SCROLLBARWIDTH_INITIAL * ScreenDScale); } WndOwnerDrawFrame* FileListEntry = (WndOwnerDrawFrame*) wfDlg->FindByName(TEXT("frmIgcFileListEntry")); if (FileListEntry) { FileListEntry->SetCanFocus(true); FileListEntry->SetWidth(wndFileList->GetWidth() - wndFileList->ScrollbarWidth - 5); } DlgIgcFile::ScanFile(); wndFileList->ResetList(); wndFileList->Redraw(); } } if (wfDlg->ShowModal()) { } delete wfDlg; wfDlg = NULL; }
void WaypointDetailsWidget::OnMagnifyClicked() { if (zoom >= 5) return; zoom++; UpdateZoomControls(); image_window.Invalidate(); }
// checklistmode: 0=notepad 1=logbook 2=... void dlgChecklistShowModal(short checklistmode){ WndListFrame* wDetails = NULL; WndOwnerDrawFrame* wDetailsEntry = NULL; InitNotepad(); LoadChecklist(checklistmode); // check if loaded really something WndForm* wf = dlgLoadFromXML(CallBackTable, ScreenLandscape ? IDR_XML_CHECKLIST_L : IDR_XML_CHECKLIST_P); aTextLine.clear(); if (!wf) goto deinit; wf->SetKeyDownNotify(FormKeyDown); ((WndButton *)wf->FindByName(TEXT("cmdClose")))->SetOnClickNotify(OnCloseClicked); wDetails = (WndListFrame*)wf->FindByName(TEXT("frmDetails")); if (!wDetails) { StartupStore(_T("..... NOTEPAD ERROR NULL frmDetails!\n")); goto deinit; } wDetails->SetBorderKind(BORDERLEFT); wDetailsEntry = (WndOwnerDrawFrame*)wf->FindByName(TEXT("frmDetailsEntry")); if (!wDetailsEntry) { StartupStore(_T("..... NOTEPAD ERROR NULL frmDetailsEntry!\n")); goto deinit; } wDetailsEntry->SetCanFocus(true); page = 0; NextPage(wf, 0); wf->ShowModal(); deinit: delete wf; DeinitNotepad(); }
void WaypointDetailsWidget::OnShrinkClicked() { if (zoom <= 0) return; zoom--; UpdateZoomControls(); image_window.Invalidate(); }
void MoveChildren(const Layout &layout) { waypoint_name.Move(layout.waypoint_name); waypoint_details.Move(layout.waypoint_details); waypoint_remove.Move(layout.waypoint_remove); waypoint_relocate.Move(layout.waypoint_relocate); type_label.Move(layout.type_label); change_type.Move(layout.change_type); map.Move(layout.map); properties_dock.Move(layout.properties); optional_starts.Move(layout.optional_starts); score_exit.Move(layout.score_exit); }
void TaskPointWidget::Prepare(ContainerWindow &parent, const PixelRect &rc) { const Layout layout(rc, look); WindowStyle panel_style; panel_style.Hide(); panel_style.Border(); panel_style.ControlParent(); ButtonWindowStyle button_style; button_style.TabStop(); CheckBoxStyle check_box_style; check_box_style.TabStop(); WindowStyle dock_style; dock_style.ControlParent(); waypoint_panel.Create(parent, look, layout.waypoint_panel, panel_style); waypoint_name.Create(waypoint_panel, layout.waypoint_name); waypoint_details.Create(waypoint_panel, look.button, _("Details"), layout.waypoint_details, button_style, *this, DETAILS); waypoint_remove.Create(waypoint_panel, look.button, _("Remove"), layout.waypoint_remove, button_style, *this, REMOVE); waypoint_relocate.Create(waypoint_panel, look.button, _("Relocate"), layout.waypoint_relocate, button_style, *this, RELOCATE); tp_panel.Create(parent, look, layout.tp_panel, panel_style); type_label.Create(tp_panel, layout.type_label); change_type.Create(tp_panel, look.button, _("Change Type"), layout.change_type, button_style, *this, CHANGE_TYPE); map.Create(tp_panel, layout.map, WindowStyle(), [this](Canvas &canvas, const PixelRect &rc){ PaintMap(canvas, rc); }); properties_dock.Create(tp_panel, layout.properties, dock_style); optional_starts.Create(tp_panel, look.button, _("Enable Alternate Starts"), layout.optional_starts, button_style, *this, OPTIONAL_STARTS); score_exit.Create(tp_panel, look, _("Score exit"), layout.score_exit, check_box_style, *this, SCORE_EXIT); RefreshView(); }
void WaypointDetailsWidget::UpdatePage() { info_dock.SetVisible(page == 0); details_panel.SetVisible(page == 1); commands_dock.SetVisible(page == 2); bool image_page = page >= 3; if (!images.empty()) { image_window.SetVisible(image_page); magnify_button.SetVisible(image_page); shrink_button.SetVisible(image_page); } }
void dlgHelpShowModal(const TCHAR* Caption, const TCHAR* HelpText) { if (!Caption || !HelpText) { return; } std::unique_ptr<WndForm> wf(dlgLoadFromXML(CallBackTable, ScreenLandscape ? IDR_XML_HELP_L : IDR_XML_HELP_P)); if(!wf) { return; } WndListFrame* wHelp = static_cast<WndListFrame*>(wf->FindByName(TEXT("frmDetails"))); if(!wHelp) { return; } wHelp->SetBorderKind(BORDERLEFT); WndOwnerDrawFrame* wHelpEntry = static_cast<WndOwnerDrawFrame*>(wf->FindByName(TEXT("frmDetailsEntry"))); if (!wHelpEntry) { return; }; wHelpEntry->SetCanFocus(true); DrawListIndex=0; TCHAR fullcaption[100]; _stprintf(fullcaption,TEXT("%s: %s"), MsgToken(336), Caption); // Help wf->SetCaption(fullcaption); aTextLine.clear(); { LKWindowSurface Surface(*wHelpEntry); const auto oldFont = Surface.SelectObject(wHelpEntry->GetFont()); const int minHeight = Surface.GetTextHeight(_T("dp")) + 2 * DLGSCALE(2); const int wHeight = wHelpEntry->GetHeight(); if(minHeight != wHeight) { wHelpEntry->SetHeight(minHeight); } aTextLine.update(Surface, wHelpEntry->GetWidth(), LKgethelptext(HelpText)); Surface.SelectObject(oldFont); } wHelp->ResetList(); wHelp->Redraw(); wf->ShowModal(); aTextLine.clear(); }
void Hide() override { if (task_manager != nullptr) goto_button.Hide(); if (!images.empty()) { magnify_button.Hide(); shrink_button.Hide(); } previous_button.Hide(); next_button.Hide(); close_button.Hide(); info_dock.Hide(); details_panel.Hide(); commands_dock.Hide(); if (!images.empty()) image_window.Hide(); }
void Hide() override { if (allow_navigation) goto_button.Hide(); if (!images.empty()) { magnify_button.Hide(); shrink_button.Hide(); } if (allow_navigation) { previous_button.Hide(); next_button.Hide(); } close_button.Hide(); info_dock.Hide(); details_panel.Hide(); commands_dock.Hide(); if (!images.empty()) image_window.Hide(); }
void TaskPointWidget::OnModified(ObservationZoneEditWidget &widget) { ReadValues(); map.Invalidate(); }
void dlgTaskManager::dlgTaskManagerShowModal(SingleWindow &parent) { if (protected_task_manager == NULL) return; wf = LoadDialog(CallBackTable, parent, Layout::landscape ? _T("IDR_XML_TASKMANAGER_L") : _T("IDR_XML_TASKMANAGER")); assert(wf != NULL); active_task = protected_task_manager->task_clone(); task_modified = false; // Load tabs wTabBar = (TabBarControl*)wf->FindByName(_T("TabBar")); assert(wTabBar != NULL); wTabBar->SetClientOverlapTabs(true); if (!Layout::landscape) { WndOwnerDrawFrame* wBlackRect = (WndOwnerDrawFrame*)wf->FindByName(_T("frmBlackRect")); assert(wBlackRect); const unsigned TabLineHeight = wTabBar->GetTabLineHeight(); wBlackRect->move(0, wTabBar->GetTabHeight() - TabLineHeight - Layout::Scale(1), wf->get_width() - wTabBar->GetTabWidth() + Layout::Scale(3), TabLineHeight + Layout::Scale(2)); wBlackRect->show_on_top(); } Window* wProps = pnlTaskProperties::Load(parent, wTabBar, wf, &active_task, &task_modified); assert(wProps); Window* wClose = pnlTaskManagerClose::Load(parent, wTabBar, wf, &active_task, &task_modified); assert(wClose); Window* wCalculator = pnlTaskCalculator::Load(parent, wTabBar, wf, &task_modified); assert(wCalculator); Window* wEdit = pnlTaskEdit::Load(parent, wTabBar, wf, &active_task, &task_modified); assert(wEdit); WndOwnerDrawFrame* wTaskView = (WndOwnerDrawFrame*)wf->FindByName(_T("frmTaskView")); assert(wTaskView); TaskViewRect = wTaskView->get_position(); Window* wLst = pnlTaskList::Load(parent, wTabBar, wf, &active_task, &task_modified); assert(wLst); const DialogTabStyle_t IconsStyle = Appearance.DialogTabStyle; const Bitmap *CalcIcon = ((IconsStyle == dtIcon) ? &Graphics::hBmpTabCalculator : NULL); const Bitmap *TurnPointIcon = ((IconsStyle == dtIcon) ? &Graphics::hBmpTabTask : NULL); const Bitmap *BrowseIcon = ((IconsStyle == dtIcon) ? &Graphics::hBmpTabWrench : NULL); const Bitmap *PropertiesIcon = ((IconsStyle == dtIcon) ? &Graphics::hBmpTabSettings : NULL); if (Layout::landscape) { wTabBar->AddClient(wCalculator, _T("Calculator"), false, CalcIcon, NULL, pnlTaskCalculator::OnTabPreShow, dlgTaskManager::SetTitle); wTabBar->AddClient(wEdit, _T("Turn Points"), false, TurnPointIcon, NULL, pnlTaskEdit::OnTabPreShow, dlgTaskManager::SetTitle, pnlTaskEdit::OnTabReClick); TurnpointTab = 1; wTabBar->AddClient(wLst, _T("Manage"), false, BrowseIcon, NULL, pnlTaskList::OnTabPreShow, dlgTaskManager::SetTitle, pnlTaskList::OnTabReClick); wTabBar->AddClient(wProps, _T("Rules"), false, PropertiesIcon, pnlTaskProperties::OnTabPreHide, pnlTaskProperties::OnTabPreShow, dlgTaskManager::SetTitle, pnlTaskProperties::OnTabReClick); PropertiesTab = 3; wTabBar->AddClient(wClose, _T("Close"), false, NULL, NULL, pnlTaskManagerClose::OnTabPreShow, dlgTaskManager::SetTitle, pnlTaskManagerClose::OnTabReClick); wTabBar->SetCurrentPage(0); } else { wTabBar->AddClient(wCalculator, _T("Calculator"), false, CalcIcon, NULL, pnlTaskCalculator::OnTabPreShow, dlgTaskManager::SetTitle); wTabBar->AddClient(wClose, _T("Close"), false, NULL, NULL, pnlTaskManagerClose::OnTabPreShow, dlgTaskManager::SetTitle, pnlTaskManagerClose::OnTabReClick); wTabBar->AddClient(wEdit, _T("Turn Points"), false, TurnPointIcon, NULL, pnlTaskEdit::OnTabPreShow, dlgTaskManager::SetTitle, pnlTaskEdit::OnTabReClick); TurnpointTab = 2; wTabBar->AddClient(wLst, _T("Manage"), false, BrowseIcon, NULL, pnlTaskList::OnTabPreShow, dlgTaskManager::SetTitle, pnlTaskList::OnTabReClick); wTabBar->AddClient(wProps, _T("Rules"), false, PropertiesIcon, pnlTaskProperties::OnTabPreHide, pnlTaskProperties::OnTabPreShow, dlgTaskManager::SetTitle, pnlTaskProperties::OnTabReClick); PropertiesTab = 4; wTabBar->SetCurrentPage(0); } fullscreen = false; wf->ShowModal(); pnlTaskList::DestroyTab(); delete wf; delete active_task; }
void TaskPointWidget::RefreshView() { map.Invalidate(); OrderedTaskPoint &tp = ordered_task.GetPoint(active_index); properties_dock.DeleteWidget(); ObservationZonePoint &oz = tp.GetObservationZone(); const bool is_fai_general = ordered_task.GetFactoryType() == TaskFactoryType::FAI_GENERAL; auto *properties_widget = CreateObservationZoneEditWidget(oz, is_fai_general); if (properties_widget != nullptr) { properties_widget->SetListener(this); properties_dock.SetWidget(properties_widget); } else properties_dock.SetWidget(new PanelWidget()); type_label.SetCaption(OrderedTaskPointName(ordered_task.GetFactory().GetType(tp))); previous_button->SetEnabled(active_index > 0); next_button->SetEnabled(active_index < (ordered_task.TaskSize() - 1)); optional_starts.SetVisible(active_index == 0); if (!ordered_task.HasOptionalStarts()) optional_starts.SetCaption(_("Enable Alternate Starts")); else { StaticString<50> tmp; tmp.Format(_T("%s (%d)"), _("Edit Alternates"), ordered_task.GetOptionalStartPointCount()); optional_starts.SetCaption(tmp); } if (tp.GetType() == TaskPointType::AST) { const ASTPoint &ast = (const ASTPoint &)tp; score_exit.Show(); score_exit.SetState(ast.GetScoreExit()); } else score_exit.Hide(); StaticString<100> name_prefix_buffer, type_buffer; switch (tp.GetType()) { case TaskPointType::START: type_buffer = _("Start point"); name_prefix_buffer = _T("Start: "); break; case TaskPointType::AST: type_buffer = _("Task point"); name_prefix_buffer.Format(_T("%d: "), active_index); break; case TaskPointType::AAT: type_buffer = _("Assigned area point"); name_prefix_buffer.Format(_T("%d: "), active_index); break; case TaskPointType::FINISH: type_buffer = _("Finish point"); name_prefix_buffer = _T("Finish: "); break; default: gcc_unreachable(); } dialog.SetCaption(type_buffer); { StaticString<100> buffer; buffer.Format(_T("%s %s"), name_prefix_buffer.c_str(), tp.GetWaypoint().name.c_str()); waypoint_name.SetCaption(buffer); } }
void WaypointDetailsWidget::Prepare(ContainerWindow &parent, const PixelRect &rc) { for (const auto &i : waypoint.files_embed) { if (images.full()) break; try { if (!images.append().LoadFile(LocalPath(i.c_str()))) images.shrink(images.size() - 1); } catch (const std::exception &e) { LogFormat("Failed to load %s: %s", (const char *)NarrowPathName(Path(i.c_str())), e.what()); images.shrink(images.size() - 1); } } const Layout layout(rc, waypoint); WindowStyle dock_style; dock_style.Hide(); dock_style.ControlParent(); WindowStyle button_style; button_style.Hide(); button_style.TabStop(); if (allow_navigation) goto_button.Create(parent, look.button, _("GoTo"), layout.goto_button, button_style, *this, GOTO); if (!images.empty()) { magnify_button.Create(parent, layout.magnify_button, button_style, new SymbolButtonRenderer(look.button, _T("+")), *this, MAGNIFY); shrink_button.Create(parent, layout.shrink_button, button_style, new SymbolButtonRenderer(look.button, _T("-")), *this, SHRINK); } if (allow_navigation) { previous_button.Create(parent, layout.previous_button, button_style, new SymbolButtonRenderer(look.button, _T("<")), *this, PREVIOUS); next_button.Create(parent, layout.next_button, button_style, new SymbolButtonRenderer(look.button, _T(">")), *this, NEXT); } close_button.Create(parent, look.button, _("Close"), layout.close_button, button_style, dialog, mrOK); info_dock.Create(parent, layout.main, dock_style); info_dock.SetWidget(&info_widget); details_panel.Create(parent, look, layout.main, dock_style); details_text.Create(details_panel, layout.details_text); details_text.SetFont(look.text_font); details_text.SetText(waypoint.details.c_str()); #ifdef HAVE_RUN_FILE const unsigned num_files = std::distance(waypoint.files_external.begin(), waypoint.files_external.end()); if (num_files > 0) { file_list.Create(details_panel, layout.file_list, WindowStyle(), layout.file_list_item_height); file_list.SetItemRenderer(&file_list_handler); file_list.SetCursorHandler(&file_list_handler); file_list.SetLength(num_files); } #endif commands_dock.Create(parent, layout.main, dock_style); commands_dock.SetWidget(&commands_widget); if (!images.empty()) image_window.Create(parent, layout.main, dock_style, [this](Canvas &canvas, const PixelRect &rc){ OnImagePaint(canvas, rc); }); last_page = 2 + images.size(); }