예제 #1
0
 void ColorChooser::Resync(Lum::Base::Model* model, const Lum::Base::ResyncMsg& msg)
 {
   if (model==okAction && okAction->IsFinished()) {
     color->Save();
     Exit();
   }
   else if (model==GetClosedAction() && GetClosedAction()->IsFinished()) {
     Exit();
   }
   else {
     Dialog::Resync(model,msg);
   }
 }
예제 #2
0
    void ColorChooser::PreInit()
    {
      ColorView   *colorView;
      Panel       *hPanel;
      RGBControl  *rgb;

      hPanel=HPanel::Create(true,false);

      colorView=new ColorView();
      colorView->SetFlex(true,true);
      colorView->SetModel(color);
      hPanel->Add(colorView);

      hPanel->AddSpace();

      rgb=new RGBControl();
      rgb->SetModel(color);
      hPanel->Add(rgb);

      SetMain(VPanel::Create(true,false)
              ->Add(hPanel)
              ->AddSpace()
              ->Add(ButtonRow::CreateOkCancel(okAction,GetClosedAction(),true,false)));

      Dialog::PreInit();
    }
예제 #3
0
 ColorChooser::ColorChooser(Model::Color* color)
 : color(color),
   okAction(new Lum::Model::Action)
 {
   Observe(okAction);
   Observe(GetClosedAction());
 }
예제 #4
0
  MainDialog()
   : locationSearchAction(new Lum::Model::Action()),
     routeAction(new Lum::Model::Action()),
     settingsAction(new Lum::Model::Action()),
     debugFlushCacheAction(new Lum::Model::Action()),
     debugStatisticsAction(new Lum::Model::Action()),
     aboutAction(new Lum::Model::Action()),
     map(NULL)
  {
    GetWindow()->SetScreenOrientationHint(Lum::OS::Window::screenOrientationBothSupported);

    Observe(GetOpenedAction());
    Observe(GetClosedAction());
    Observe(locationSearchAction);
    Observe(routeAction);
    Observe(settingsAction);
    Observe(debugFlushCacheAction);
    Observe(debugStatisticsAction);
    Observe(aboutAction);
  }
예제 #5
0
  void PreInit()
  {
    map=new MapControl();
    map->SetFlex(true,true);

    SetMain(map);

    Lum::Def::Menu *menu=Lum::Def::Menu::Create();

    menu
      ->GroupProject()
        ->ActionQuit(GetClosedAction())
      ->End()
      ->Group(L"_Search")
        ->Action(Lum::Def::Action(Lum::Def::Desc(L"Search _location")
                                  .SetShortcut(Lum::OS::qualifierControl,L"f"),
                                  locationSearchAction))
        ->Separator()
        ->Action(Lum::Def::Action(Lum::Def::Desc(L"_Route")
                                  .SetShortcut(Lum::OS::qualifierControl,L"r"),
                                  routeAction))
      ->End()
      ->GroupEdit()
        ->ActionSettings(settingsAction)
      ->End()
      ->Group(L"Debug")
        ->Action(Lum::Def::Action(Lum::Def::Desc(L"_Flush Cache"),
                                  debugFlushCacheAction))
        ->Action(Lum::Def::Action(Lum::Def::Desc(L"Dump _statistics")
                                  .SetShortcut(Lum::OS::qualifierControl,L"s"),
                                  debugStatisticsAction))
      ->End()
      ->GroupHelp()
        //->ActionHelp()(
        ->ActionAbout(aboutAction)
      ->End();

    SetMenu(menu);

    Dialog::PreInit();
  }
예제 #6
0
  void Resync(Lum::Base::Model* model, const Lum::Base::ResyncMsg& msg)
  {
    if (model==GetOpenedAction() && GetOpenedAction()->IsFinished()) {
      if (!LoadConfig()) {
        Lum::Dlg::Msg::ShowOk(this,
                              L"Cannot load configuration!",
                              L"Cannot load configuration!");
      }

      if (!currentMap.empty() && !currentStyle.empty()) {
        if (databaseTask->Open(currentMap)) {
          if (databaseTask->LoadStyleConfig(currentStyle,styleConfig)) {
            databaseTask->SetStyle(styleConfig);
          }
          else {
            std::cerr << "Cannot load style configuration '" << Lum::Base::WStringToString(currentStyle) << "'" << std::endl;
          }
        }
        else {
          std::cerr << "Cannot initialize database!" << std::endl;
        }
      }
      else {
        Lum::Dlg::Msg::ShowOk(this,
                              L"Cannot show map!",
                              L"No map and/or style configured!");
      }

      map->RequestNewMap();
    }
    else if (model==GetClosedAction() &&
             GetClosedAction()->IsFinished()) {
      SaveConfig();
    }
    else if (model==locationSearchAction &&
             locationSearchAction->IsFinished()) {
      LocationSearchDialog::Location location;
      bool                           hasResult=false;

      LocationSearchDialog *dialog;

      dialog=new LocationSearchDialog(databaseTask);
      dialog->SetParent(this);
      if (dialog->Open()) {
        dialog->EventLoop();
        dialog->Close();

        hasResult=dialog->HasResult();
        if (dialog->HasResult()) {
          location=dialog->GetResult();
        }
      }

      delete dialog;

      if (hasResult) {
        map->ShowReference(location.object,
                           osmscout::Magnification::magVeryClose);
      }
    }
    else if (model==routeAction &&
             routeAction->IsFinished()) {
      RouteDialog *dialog;

      dialog=new RouteDialog(databaseTask);
      dialog->SetParent(this);
      if (dialog->Open()) {
        dialog->EventLoop();
        dialog->Close();
      }

      delete dialog;
    }
    else if (model==settingsAction &&
             settingsAction->IsFinished()) {
      Lum::Def::PropGroup           *props=new Lum::Def::PropGroup();
      std::wstring                  label;
      osmscout::AreaSearchParameter searchParameter;

      label=L"DPI";
      label+=L" ("+Lum::Base::NumberToWString(dpi->GetMinAsUnsignedLong())+L"-"+Lum::Base::NumberToWString(dpi->GetMaxAsUnsignedLong())+L")";
      props->Number(Lum::Def::Number(Lum::Def::Desc(label),dpi));

      label=L"Maximum nodes";

      if (searchParameter.GetMaximumNodes()==std::numeric_limits<unsigned long>::max()) {
        label+=L" (unlimited)";
      }
      else {
        label+=L" ("+Lum::Base::NumberToWString(searchParameter.GetMaximumNodes())+L")";
      }
      props->Number(Lum::Def::Number(Lum::Def::Desc(label),maxNodes));

      label=L"Maximum ways";
      if (searchParameter.GetMaximumWays()==std::numeric_limits<unsigned long>::max()) {
        label+=L" (unlimited)";
      }
      else {
        label+=L" ("+Lum::Base::NumberToWString(searchParameter.GetMaximumWays())+L")";
      }
      props->Number(Lum::Def::Number(Lum::Def::Desc(label),maxWays));

      label=L"Maximum areas";
      if (searchParameter.GetMaximumAreas()==std::numeric_limits<unsigned long>::max()) {
        label+=L" (unlimited)";
      }
      else {
        label+=L" ("+Lum::Base::NumberToWString(searchParameter.GetMaximumAreas())+L")";
      }
      props->Number(Lum::Def::Number(Lum::Def::Desc(label),maxAreas));

      props->Boolean(Lum::Def::Boolean(Lum::Def::Desc(L"Optimize ways"),optimizeWays));
      props->Boolean(Lum::Def::Boolean(Lum::Def::Desc(L"Optimize areas"),optimizeAreas));

      Lum::Dlg::Properties::Show(this,props);

      map->RequestNewMap();

      delete props;

    }
    else if (model==debugFlushCacheAction && debugFlushCacheAction->IsFinished()) {
      database->FlushCache();
    }
    else if (model==debugStatisticsAction && debugStatisticsAction->IsFinished()) {
      database->DumpStatistics();
    }
    else if (model==aboutAction && aboutAction->IsFinished()) {
      Lum::Dlg::About::Show(this,info);
    }

    Dialog::Resync(model,msg);
  }