437
475
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
438
476
glEnable(GL_BLEND);
440
int x = core->getViewportPosX() + core->getViewportWidth()/2;
441
int y = core->getViewportPosY() + core->getViewportHeight()/2;
442
int shift = (int)(M_SQRT2 / 2 * MY_MIN(core->getViewportWidth()/2, core->getViewportHeight()/2));
478
int x = core->getProjection()->getViewportPosX() + core->getProjection()->getViewportWidth()/2;
479
int y = core->getProjection()->getViewportPosY() + core->getProjection()->getViewportHeight()/2;
480
int shift = (int)(M_SQRT2 / 2 * MY_MIN(core->getProjection()->getViewportWidth()/2, core->getProjection()->getViewportHeight()/2));
444
if(!core->getFlagGravityLabels()) {
482
if(!core->getProjection()->getFlagGravityLabels()) {
445
483
// for horizontal tui move to left edge of screen kludge
447
x = core->getViewportPosX() + int(0.1*core->getViewportWidth());
448
y = core->getViewportPosY() + int(0.1*core->getViewportHeight());
485
x = core->getProjection()->getViewportPosX() + int(0.1*core->getProjection()->getViewportWidth());
486
y = core->getProjection()->getViewportPosY() + int(0.1*core->getProjection()->getViewportHeight());
453
491
glColor3f(0.5,1,0.5);
454
core->printGravity(tuiFont, x+shift - 30, y-shift + 38, s_tui::stop_active + tui_root->getString(), 0);
492
core->getProjection()->drawText(tuiFont, x+shift - 30, y-shift + 38, s_tui::stop_active + tui_root->getString(), 0, 0, 0, false);
458
int StelUI::handle_keys_tui(Uint16 key, s_tui::S_TUI_VALUE state)
496
int StelUI::handle_keys_tui(Uint16 key, Uint8 state)
460
return tui_root->onKey(key, state);
498
if (!FlagShowTuiMenu)
502
if (state==Stel_KEYDOWN && key=='m')
505
FlagShowTuiMenu = false;
507
// If selected a script in tui, run that now
508
if(SelectedScript!="")
510
// build up a command string
512
if (SelectedScriptDirectory!="")
513
cmd = "script action play filename \"" + SelectedScript + "\" path \"" + SelectedScriptDirectory + "/scripts/\"";
518
QString theParent = app->getFileMgr().findFile(QString("scripts/") + SelectedScript.c_str());
519
theParent = app->getFileMgr().dirName(theParent);
520
cmd = "script action play filename \"" + SelectedScript
521
+ "\" path \"" + QFile::encodeName(theParent).constData() + "/\"";
525
cerr << "ERROR while executing script " << SelectedScript << ": " << e.what() << endl;
529
// now execute the command
530
StelCommandInterface* commander = (StelCommandInterface*)StelApp::getInstance().getModuleMgr().getModule("StelCommandInterface");
532
commander->execute_command(cmd);
534
cerr << "ERROR while executing script" << endl;
538
SelectedScriptDirectory = SelectedScript = "";
541
tui_root->onKey(key, state);
463
545
// Update all the core parameters with values taken from the tui widgets
464
546
void StelUI::tui_cb1(void)
466
548
// 2. Date & Time
467
app->PresetSkyTime = tui_time_presetskytime->getJDay();
468
app->StartupTimeMode = StelUtility::wstringToString(tui_time_startuptime->getCurrent());
549
core->getNavigation()->setPresetSkyTime(tui_time_presetskytime->getJDay());
550
core->getNavigation()->setStartupTimeMode(StelUtils::wstringToString(tui_time_startuptime->getCurrent()));
472
553
// Update all the tui widgets with values taken from the core parameters
473
554
void StelUI::tui_update_widgets(void)
475
559
if (!FlagShowTuiMenu) return;
561
StarMgr* smgr = (StarMgr*)app->getModuleMgr().getModule("StarMgr");
562
ConstellationMgr* cmgr = (ConstellationMgr*)app->getModuleMgr().getModule("ConstellationMgr");
563
NebulaMgr* nmgr = (NebulaMgr*)app->getModuleMgr().getModule("NebulaMgr");
564
SolarSystem* ssmgr = (SolarSystem*)app->getModuleMgr().getModule("SolarSystem");
565
MilkyWay* mw = (MilkyWay*)app->getModuleMgr().getModule("MilkyWay");
566
LandscapeMgr* lmgr = (LandscapeMgr*)app->getModuleMgr().getModule("LandscapeMgr");
567
GridLinesMgr* grlmgr = (GridLinesMgr*)app->getModuleMgr().getModule("GridLinesMgr");
568
MovementMgr* mvmgr = (MovementMgr*)app->getModuleMgr().getModule("MovementMgr");
478
tui_location_latitude->setValue(core->getObservatory().get_latitude());
479
tui_location_longitude->setValue(core->getObservatory().get_longitude());
480
tui_location_altitude->setValue(core->getObservatory().get_altitude());
481
tui_location_planet->setValue(StelUtility::stringToWstring(core->getObservatory().getHomePlanetEnglishName()));
571
tui_location_latitude->setValue(core->getObservatory()->get_latitude());
572
tui_location_longitude->setValue(core->getObservatory()->get_longitude());
573
tui_location_altitude->setValue(core->getObservatory()->get_altitude());
483
576
// 2. Date & Time
484
tui_time_skytime->setJDay(core->getJDay() + app->get_GMT_shift(core->getJDay())*JD_HOUR);
485
tui_time_settmz->settz(app->get_custom_tz_name());
486
tui_time_presetskytime->setJDay(app->PresetSkyTime);
487
tui_time_startuptime->setCurrent(StelUtility::stringToWstring(app->StartupTimeMode));
488
tui_time_displayformat->setCurrent(StelUtility::stringToWstring(app->get_time_format_str()));
489
tui_time_dateformat->setCurrent(StelUtility::stringToWstring(app->get_date_format_str()));
577
tui_time_skytime->setJDay(core->getNavigation()->getJDay() + app->getLocaleMgr().get_GMT_shift(core->getNavigation()->getJDay())*JD_HOUR);
578
tui_time_settmz->settz(app->getLocaleMgr().get_custom_tz_name());
579
tui_time_day_key->setCurrent(StelUtils::stringToWstring(getDayKeyMode()));
580
tui_time_presetskytime->setJDay(core->getNavigation()->getPresetSkyTime());
581
tui_time_startuptime->setCurrent(StelUtils::stringToWstring(core->getNavigation()->getStartupTimeMode()));
582
tui_time_displayformat->setCurrent(StelUtils::stringToWstring(app->getLocaleMgr().get_time_format_str()));
583
tui_time_dateformat->setCurrent(StelUtils::stringToWstring(app->getLocaleMgr().get_date_format_str()));
492
tui_general_sky_culture->setValue(StelUtility::stringToWstring(core->getSkyCultureDir()));
493
tui_general_sky_locale->setValue(StelUtility::stringToWstring(core->getSkyLanguage()));
586
tui_general_sky_culture->setValue(app->getSkyCultureMgr().getSkyCultureDir().toStdWString());
587
tui_general_sky_locale->setValue(app->getLocaleMgr().getSkyLanguage().toStdWString());
496
tui_stars_show->setValue(core->getFlagStars());
497
tui_star_labelmaxmag->setValue(core->getMaxMagStarName());
498
tui_stars_twinkle->setValue(core->getStarTwinkleAmount());
499
tui_star_magscale->setValue(core->getStarMagScale());
590
tui_stars_show->setValue(smgr->getFlagStars());
591
tui_star_labelmaxmag->setValue(smgr->getMaxMagName());
592
tui_stars_twinkle->setValue(smgr->getTwinkleAmount());
593
tui_star_magscale->setValue(smgr->getMagScale());
594
// TODO tui_star_limitingmag->setValue(core->getStarLimitingMag());
502
tui_colors_const_line_color->setVector(core->getColorConstellationLine());
503
tui_colors_const_label_color->setVector(core->getColorConstellationNames());
504
tui_colors_cardinal_color->setVector(core->getColorCardinalPoints());
505
tui_colors_const_art_intensity->setValue(core->getConstellationArtIntensity());
506
tui_colors_const_boundary_color->setVector(core->getColorConstellationBoundaries());
507
tui_colors_planet_names_color->setVector(core->getColorPlanetsNames());
508
tui_colors_planet_orbits_color->setVector(core->getColorPlanetsOrbits());
509
tui_colors_object_trails_color->setVector(core->getColorPlanetsTrails());
510
tui_colors_meridian_color->setVector(core->getColorMeridianLine());
511
tui_colors_azimuthal_color->setVector(core->getColorAzimutalGrid());
512
tui_colors_equatorial_color->setVector(core->getColorEquatorGrid());
513
tui_colors_equator_color->setVector(core->getColorEquatorLine());
514
tui_colors_ecliptic_color->setVector(core->getColorEclipticLine());
515
tui_colors_nebula_label_color->setVector(core->getColorNebulaLabels());
516
tui_colors_nebula_circle_color->setVector(core->getColorNebulaCircle());
598
tui_colors_const_line_color->setVector(cmgr->getLinesColor());
599
tui_colors_const_label_color->setVector(cmgr->getNamesColor());
600
tui_colors_const_art_intensity->setValue(cmgr->getArtIntensity());
601
tui_colors_const_boundary_color->setVector(cmgr->getBoundariesColor());
602
tui_colors_cardinal_color->setVector(lmgr->getColorCardinalPoints());
603
tui_colors_planet_names_color->setVector(ssmgr->getNamesColor());
604
tui_colors_planet_orbits_color->setVector(ssmgr->getOrbitsColor());
605
tui_colors_object_trails_color->setVector(ssmgr->getTrailsColor());
606
tui_colors_meridian_color->setVector(grlmgr->getColorMeridianLine());
607
tui_colors_azimuthal_color->setVector(grlmgr->getColorAzimutalGrid());
608
tui_colors_equatorial_color->setVector(grlmgr->getColorEquatorGrid());
609
tui_colors_equator_color->setVector(grlmgr->getColorEquatorLine());
610
tui_colors_ecliptic_color->setVector(grlmgr->getColorEclipticLine());
611
tui_colors_nebula_label_color->setVector(nmgr->getNamesColor());
612
tui_colors_nebula_circle_color->setVector(nmgr->getCirclesColor());
520
tui_effect_landscape->setValue(StelUtility::stringToWstring(core->getObservatory().get_landscape_name()));
521
tui_effect_pointobj->setValue(core->getFlagPointStar());
522
tui_effect_zoom_duration->setValue(core->getAutomoveDuration());
523
tui_effect_manual_zoom->setValue(core->getFlagManualAutoZoom());
524
tui_effect_object_scale->setValue(core->getStarScale());
525
tui_effect_milkyway_intensity->setValue(core->getMilkyWayIntensity());
616
tui_effect_light_pollution->setValue(lmgr->getAtmosphereLightPollutionLuminance());
617
tui_effect_landscape->setValue(lmgr->getLandscapeName().toStdWString());
618
tui_effect_pointobj->setValue(smgr->getFlagPointStar());
619
tui_effect_zoom_duration->setValue(mvmgr->getAutoMoveDuration());
620
tui_effect_manual_zoom->setValue(mvmgr->getFlagManualAutoZoom());
621
tui_effect_object_scale->setValue(smgr->getScale());
622
tui_effect_milkyway_intensity->setValue(mw->getIntensity());
526
623
tui_effect_cursor_timeout->setValue(MouseCursorTimeout);
527
tui_effect_nebulae_label_magnitude->setValue(core->getNebulaMaxMagHints());
624
tui_effect_nebulae_label_magnitude->setValue(nmgr->getMaxMagHints());
625
tui_effect_landscape_sets_location->setValue(lmgr->getFlagLandscapeSetsLocation());
531
629
// each fresh time enter needs to reset to select message
532
if(app->SelectedScript=="") {
630
if(SelectedScript=="") {
533
631
tui_scripts_local->setCurrent(_(TUI_SCRIPT_MSG));
535
633
if(ScriptDirectoryRead) {
568
666
// Load default configuration
569
667
void StelUI::tui_cb_admin_load_default(void)
670
tuiUpdateIndependentWidgets();
574
673
// Save to default configuration
575
674
void StelUI::tui_cb_admin_save_default(void)
577
app->saveCurrentConfig(app->getConfigFile());
678
saveCurrentConfig(app->getConfigFilePath());
682
cerr << "ERROR: could not save config.ini file: " << e.what() << endl;
579
system( ( core->getDataDir() + "script_save_config " ).c_str() );
687
system( QFile::encodeName(app->getFileMgr().findFile("data/script_save_config ")).constData());
691
cerr << "ERROR while calling script_save_config: " << e.what() << endl;
582
695
// Launch script for internet update
583
696
void StelUI::tui_cb_admin_updateme(void)
585
system( ( core->getDataDir() + "script_internet_update" ).c_str() );
700
system( QFile::encodeName(app->getFileMgr().findFile("data/script_internet_update ")).constData());
704
cerr << "ERROR while calling script_internet_update: " << e.what() << endl;
709
// Launch script for shutdown, then exit
710
void StelUI::tui_cb_admin_shutdown(void)
714
system( QFile::encodeName(app->getFileMgr().findFile("data/script_shutdown ")).constData());
718
cerr << "ERROR while calling script_shutdown: " << e.what() << endl;
720
app->terminateApplication();
588
723
// Set a new landscape skin
589
724
void StelUI::tui_cb_tui_effect_change_landscape(void)
591
app->commander->execute_command(string("set landscape_name " + StelUtility::wstringToString(tui_effect_landscape->getCurrent())));
726
StelCommandInterface* commander = (StelCommandInterface*)StelApp::getInstance().getModuleMgr().getModule("StelCommandInterface");
727
commander->execute_command(string("set landscape_name \"" + StelUtils::wstringToString(tui_effect_landscape->getCurrent()) + "\""));
595
731
// Set a new sky culture
596
732
void StelUI::tui_cb_tui_general_change_sky_culture(void) {
733
StelCommandInterface* commander = (StelCommandInterface*)StelApp::getInstance().getModuleMgr().getModule("StelCommandInterface");
598
734
// core->setSkyCulture(tui_general_sky_culture->getCurrent());
599
app->commander->execute_command( string("set sky_culture ") + StelUtility::wstringToString(tui_general_sky_culture->getCurrent()));
735
commander->execute_command( string("set sky_culture ") + StelUtils::wstringToString(tui_general_sky_culture->getCurrent()));
602
738
// Set a new sky locale
603
739
void StelUI::tui_cb_tui_general_change_sky_locale(void) {
740
StelCommandInterface* commander = (StelCommandInterface*)StelApp::getInstance().getModuleMgr().getModule("StelCommandInterface");
604
741
// wcout << "set sky locale to " << tui_general_sky_locale->getCurrent() << endl;
605
app->commander->execute_command( string("set sky_locale " + StelUtility::wstringToString(tui_general_sky_locale->getCurrent())));
742
commander->execute_command( string("set sky_locale " + StelUtils::wstringToString(tui_general_sky_locale->getCurrent())));
609
#define SCRIPT_REMOVEABLE_DISK "/tmp/scripts/"
611
746
// callback for changing scripts from removeable media
612
747
void StelUI::tui_cb_scripts_removeable() {
614
748
if(!ScriptDirectoryRead) {
749
ScriptMgr* scripts = (ScriptMgr*)StelApp::getInstance().getModuleMgr().getModule("ScriptMgr");
615
750
// read scripts from mounted disk
616
string script_list = app->scripts->get_script_list(SCRIPT_REMOVEABLE_DISK);
617
tui_scripts_removeable->replaceItemList(_(TUI_SCRIPT_MSG) + wstring(L"\n") + StelUtility::stringToWstring(script_list),0);
751
string script_list = scripts->get_script_list(scripts->get_removable_media_path());
752
tui_scripts_removeable->replaceItemList(_(TUI_SCRIPT_MSG) + wstring(L"\n") + StelUtils::stringToWstring(script_list),0);
618
753
ScriptDirectoryRead = 1;
621
756
if(tui_scripts_removeable->getCurrent()==_(TUI_SCRIPT_MSG)) {
622
app->SelectedScript = "";
624
app->SelectedScript = StelUtility::wstringToString(tui_scripts_removeable->getCurrent());
625
app->SelectedScriptDirectory = SCRIPT_REMOVEABLE_DISK;
759
ScriptMgr* scripts = (ScriptMgr*)StelApp::getInstance().getModuleMgr().getModule("ScriptMgr");
760
SelectedScript = StelUtils::wstringToString(tui_scripts_removeable->getCurrent());
761
SelectedScriptDirectory = scripts->get_removable_media_path().toStdString();
626
762
// to avoid confusing user, clear out local script selection as well
627
763
tui_scripts_local->setCurrent(_(TUI_SCRIPT_MSG));
632
// callback for changing scripts from local directory
633
void StelUI::tui_cb_scripts_local() {
635
if(tui_scripts_local->getCurrent()!=_(TUI_SCRIPT_MSG)){
636
app->SelectedScript = StelUtility::wstringToString(tui_scripts_local->getCurrent());
637
app->SelectedScriptDirectory = core->getDataDir() + "scripts/";
638
// to reduce confusion for user, clear out removeable script selection as well
639
if(ScriptDirectoryRead) tui_scripts_removeable->setCurrent(_(TUI_SCRIPT_MSG));
641
app->SelectedScript = "";
767
/****************************************************************************
768
callback for changing scripts from local directory
769
****************************************************************************/
770
void StelUI::tui_cb_scripts_local() {
771
if(tui_scripts_local->getCurrent()!=_(TUI_SCRIPT_MSG))
773
SelectedScript = StelUtils::wstringToString(tui_scripts_local->getCurrent());
774
SelectedScriptDirectory = "";
775
// to reduce confusion for user, clear out removeable script selection as well
776
if(ScriptDirectoryRead)
777
tui_scripts_removeable->setCurrent(_(TUI_SCRIPT_MSG));
646
786
// change UI locale
647
787
void StelUI::tui_cb_admin_set_locale() {
649
app->setAppLanguage(StelUtility::wstringToString(tui_admin_setlocale->getCurrent()));
789
app->getLocaleMgr().setAppLanguage(QString::fromStdWString(tui_admin_setlocale->getCurrent()));
653
793
void StelUI::tui_cb_effects_milkyway_intensity() {
794
StelCommandInterface* commander = (StelCommandInterface*)StelApp::getInstance().getModuleMgr().getModule("StelCommandInterface");
655
795
std::ostringstream oss;
656
796
oss << "set milky_way_intensity " << tui_effect_milkyway_intensity->getValue();
657
app->commander->execute_command(oss.str());
797
commander->execute_command(oss.str());
660
800
void StelUI::tui_cb_setlocation() {
801
StelCommandInterface* commander = (StelCommandInterface*)StelApp::getInstance().getModuleMgr().getModule("StelCommandInterface");
662
802
std::ostringstream oss;
663
803
oss << "moveto lat " << tui_location_latitude->getValue()
664
804
<< " lon " << tui_location_longitude->getValue()
665
805
<< " alt " << tui_location_altitude->getValue();
666
app->commander->execute_command(oss.str());
806
commander->execute_command(oss.str());
671
811
void StelUI::tui_cb_stars()
813
StelCommandInterface* commander = (StelCommandInterface*)StelApp::getInstance().getModuleMgr().getModule("StelCommandInterface");
674
816
std::ostringstream oss;
676
818
oss << "flag stars " << tui_stars_show->getValue();
677
app->commander->execute_command(oss.str());
819
commander->execute_command(oss.str());
680
822
oss << "set max_mag_star_name " << tui_star_labelmaxmag->getValue();
681
app->commander->execute_command(oss.str());
823
commander->execute_command(oss.str());
684
826
oss << "set star_twinkle_amount " << tui_stars_twinkle->getValue();
685
app->commander->execute_command(oss.str());
827
commander->execute_command(oss.str());
688
830
oss << "set star_mag_scale " << tui_star_magscale->getValue();
689
app->commander->execute_command(oss.str());
831
commander->execute_command(oss.str());
834
oss << "set star_limiting_mag " << tui_star_limitingmag->getValue();
835
commander->execute_command(oss.str());
693
840
void StelUI::tui_cb_effects()
842
StelCommandInterface* commander = (StelCommandInterface*)StelApp::getInstance().getModuleMgr().getModule("StelCommandInterface");
697
845
std::ostringstream oss;
699
847
oss << "flag point_star " << tui_effect_pointobj->getValue();
700
app->commander->execute_command(oss.str());
848
commander->execute_command(oss.str());
703
851
oss << "set auto_move_duration " << tui_effect_zoom_duration->getValue();
704
app->commander->execute_command(oss.str());
852
commander->execute_command(oss.str());
707
855
oss << "flag manual_zoom " << tui_effect_manual_zoom->getValue();
708
app->commander->execute_command(oss.str());
856
commander->execute_command(oss.str());
711
859
oss << "set star_scale " << tui_effect_object_scale->getValue();
712
app->commander->execute_command(oss.str());
860
commander->execute_command(oss.str());
714
862
MouseCursorTimeout = tui_effect_cursor_timeout->getValue(); // never recorded
865
oss << "set light_pollution_luminance " << tui_effect_light_pollution->getValue();
866
commander->execute_command(oss.str());
869
oss << "flag landscape_sets_location " << tui_effect_landscape_sets_location->getValue();
870
commander->execute_command(oss.str());
720
876
void StelUI::tui_cb_sky_time()
878
StelCommandInterface* commander = (StelCommandInterface*)StelApp::getInstance().getModuleMgr().getModule("StelCommandInterface");
722
879
std::ostringstream oss;
723
oss << "date local " << StelUtility::wstringToString(tui_time_skytime->getDateString());
724
app->commander->execute_command(oss.str());
880
oss << "date local " << StelUtils::wstringToString(tui_time_skytime->getDateString());
881
commander->execute_command(oss.str());
728
885
// set nebula label limit
729
886
void StelUI::tui_cb_effects_nebulae_label_magnitude()
888
StelCommandInterface* commander = (StelCommandInterface*)StelApp::getInstance().getModuleMgr().getModule("StelCommandInterface");
731
889
std::ostringstream oss;
732
890
oss << "set max_mag_nebula_name " << tui_effect_nebulae_label_magnitude->getValue();
733
app->commander->execute_command(oss.str());
891
commander->execute_command(oss.str());
737
895
void StelUI::tui_cb_change_color()
739
core->setColorConstellationLine( tui_colors_const_line_color->getVector() );
740
core->setColorConstellationNames( tui_colors_const_label_color->getVector() );
741
core->setColorCardinalPoints( tui_colors_cardinal_color->getVector() );
742
core->setConstellationArtIntensity(tui_colors_const_art_intensity->getValue() );
743
core->setColorConstellationBoundaries(tui_colors_const_boundary_color->getVector() );
744
// core->setColorStarNames(
745
// core->setColorStarCircles(
746
core->setColorPlanetsOrbits(tui_colors_planet_orbits_color->getVector() );
747
core->setColorPlanetsNames(tui_colors_planet_names_color->getVector() );
748
core->setColorPlanetsTrails(tui_colors_object_trails_color->getVector() );
749
core->setColorAzimutalGrid(tui_colors_azimuthal_color->getVector() );
750
core->setColorEquatorGrid(tui_colors_equatorial_color->getVector() );
751
core->setColorEquatorLine(tui_colors_equator_color->getVector() );
752
core->setColorEclipticLine(tui_colors_ecliptic_color->getVector() );
753
core->setColorMeridianLine(tui_colors_meridian_color->getVector() );
754
core->setColorNebulaLabels(tui_colors_nebula_label_color->getVector() );
755
core->setColorNebulaCircle(tui_colors_nebula_circle_color->getVector() );
897
ConstellationMgr* cmgr = (ConstellationMgr*)app->getModuleMgr().getModule("ConstellationMgr");
898
NebulaMgr* nmgr = (NebulaMgr*)app->getModuleMgr().getModule("NebulaMgr");
899
SolarSystem* ssmgr = (SolarSystem*)app->getModuleMgr().getModule("SolarSystem");
900
LandscapeMgr* lmgr = (LandscapeMgr*)app->getModuleMgr().getModule("LandscapeMgr");
901
GridLinesMgr* grlmgr = (GridLinesMgr*)app->getModuleMgr().getModule("GridLinesMgr");
903
cmgr->setLinesColor( tui_colors_const_line_color->getVector() );
904
cmgr->setNamesColor( tui_colors_const_label_color->getVector() );
905
cmgr->setArtIntensity(tui_colors_const_art_intensity->getValue() );
906
cmgr->setBoundariesColor(tui_colors_const_boundary_color->getVector() );
908
lmgr->setColorCardinalPoints( tui_colors_cardinal_color->getVector() );
910
ssmgr->setOrbitsColor(tui_colors_planet_orbits_color->getVector() );
911
ssmgr->setNamesColor(tui_colors_planet_names_color->getVector() );
912
ssmgr->setTrailsColor(tui_colors_object_trails_color->getVector() );
913
grlmgr->setColorAzimutalGrid(tui_colors_azimuthal_color->getVector() );
914
grlmgr->setColorEquatorGrid(tui_colors_equatorial_color->getVector() );
915
grlmgr->setColorEquatorLine(tui_colors_equator_color->getVector() );
916
grlmgr->setColorEclipticLine(tui_colors_ecliptic_color->getVector() );
917
grlmgr->setColorMeridianLine(tui_colors_meridian_color->getVector() );
919
nmgr->setNamesColor(tui_colors_nebula_label_color->getVector() );
920
nmgr->setCirclesColor(tui_colors_nebula_circle_color->getVector() );
761
924
void StelUI::tui_cb_location_change_planet()
763
// core->setHomePlanet( StelUtility::wstringToString( tui_location_planet->getCurrent() ) );
764
app->commander->execute_command(string("set home_planet \"") +
765
StelUtility::wstringToString( tui_location_planet->getCurrent() ) +
926
// core->setHomePlanet( StelUtils::wstringToString( tui_location_planet->getCurrent() ) );
927
// wcout << "set home planet " << tui_location_planet->getCurrent() << endl;
928
StelCommandInterface* commander = (StelCommandInterface*)StelApp::getInstance().getModuleMgr().getModule("StelCommandInterface");
929
commander->execute_command(string("set home_planet \"") +
930
StelUtils::wstringToString( tui_location_planet->getCurrent() ) +
935
void StelUI::tui_cb_day_key()
938
setDayKeyMode( StelUtils::wstringToString(tui_time_day_key->getCurrent()) );
939
// cout << "Set from tui value DayKeyMode to " << app->DayKeyMode << endl;
943
// Update widgets that don't always match current settings with current settings
944
void StelUI::tuiUpdateIndependentWidgets(void) {
946
// Called when open tui menu
948
// Since some tui options don't immediately affect actual settings
949
// reset those options to the current values now
950
// (can not do this in tui_update_widgets)
952
tui_location_planet->setValue(StelUtils::stringToWstring(core->getObservatory()->getHomePlanetEnglishName()));
954
// Reread local script directory (in case new files)
955
ScriptMgr* scripts = (ScriptMgr*)StelApp::getInstance().getModuleMgr().getModule("ScriptMgr");
956
tui_scripts_local->replaceItemList(_(TUI_SCRIPT_MSG) + wstring(L"\n")
957
+ StelUtils::stringToWstring(scripts->get_script_list("scripts")), 0);
959
// also clear out script lists as media may have changed
960
ScriptDirectoryRead = 0;
965
// Saves all current settings
966
void StelUI::saveCurrentConfig(const QString& confFile)
968
// No longer resaves everything, just settings user can change through UI
970
StelSkyCultureMgr* skyCultureMgr = &app->getSkyCultureMgr();
971
StelLocaleMgr* localeMgr = &app->getLocaleMgr();
972
StelModuleMgr* moduleMgr = &app->getModuleMgr();
973
GridLinesMgr* grlmgr = (GridLinesMgr*)app->getModuleMgr().getModule("GridLinesMgr");
974
MovementMgr* mvmgr = (MovementMgr*)app->getModuleMgr().getModule("MovementMgr");
976
cout << "Saving configuration file " << confFile.toUtf8().data() << " ..." << endl;
981
conf.set_str ("main:version", PACKAGE_VERSION);
983
// localization section
984
conf.set_str ("localization:sky_culture", skyCultureMgr->getSkyCultureDir());
985
conf.set_str ("localization:sky_locale", localeMgr->getSkyLanguage());
986
conf.set_str ("localization:app_locale", localeMgr->getAppLanguage());
987
conf.set_str ("localization:time_display_format", localeMgr->get_time_format_str().c_str());
988
conf.set_str ("localization:date_display_format", localeMgr->get_date_format_str().c_str());
989
if (localeMgr->get_tz_format() == StelLocaleMgr::S_TZ_CUSTOM)
991
conf.set_str("localization:time_zone", localeMgr->get_custom_tz_name().c_str());
993
if (localeMgr->get_tz_format() == StelLocaleMgr::S_TZ_SYSTEM_DEFAULT)
995
conf.set_str("localization:time_zone", "system_default");
997
if (localeMgr->get_tz_format() == StelLocaleMgr::S_TZ_GMT_SHIFT)
999
conf.set_str("localization:time_zone", "gmt+x");
1003
ConstellationMgr* cmgr = (ConstellationMgr*)moduleMgr->getModule("ConstellationMgr");
1004
conf.set_boolean("viewing:flag_constellation_drawing", cmgr->getFlagLines());
1005
conf.set_boolean("viewing:flag_constellation_name", cmgr->getFlagNames());
1006
conf.set_boolean("viewing:flag_constellation_art", cmgr->getFlagArt());
1007
conf.set_boolean("viewing:flag_constellation_boundaries", cmgr->getFlagBoundaries());
1008
conf.set_boolean("viewing:flag_constellation_pick", cmgr->getFlagIsolateSelected());
1009
conf.set_double ("viewing:constellation_art_intensity", cmgr->getArtIntensity());
1010
conf.set_double ("viewing:constellation_art_fade_duration", cmgr->getArtFadeDuration());
1011
conf.set_str ("color:const_lines_color", StelUtils::vec3f_to_str(cmgr->getLinesColor()).c_str());
1012
conf.set_str ("color:const_names_color", StelUtils::vec3f_to_str(cmgr->getNamesColor()).c_str());
1013
conf.set_str ("color:const_boundary_color", StelUtils::vec3f_to_str(cmgr->getBoundariesColor()).c_str());
1015
SolarSystem* ssmgr = (SolarSystem*)moduleMgr->getModule("SolarSystem");
1016
LandscapeMgr* lmgr = (LandscapeMgr*)moduleMgr->getModule("LandscapeMgr");
1017
conf.set_double("viewing:moon_scale", ssmgr->getMoonScale());
1018
conf.set_boolean("viewing:flag_equatorial_grid", grlmgr->getFlagEquatorGrid());
1019
conf.set_boolean("viewing:flag_azimutal_grid", grlmgr->getFlagAzimutalGrid());
1020
conf.set_boolean("viewing:flag_equator_line", grlmgr->getFlagEquatorLine());
1021
conf.set_boolean("viewing:flag_ecliptic_line", grlmgr->getFlagEclipticLine());
1022
conf.set_boolean("viewing:flag_cardinal_points", lmgr->getFlagCardinalsPoints());
1023
conf.set_boolean("viewing:flag_meridian_line", grlmgr->getFlagMeridianLine());
1024
conf.set_boolean("viewing:flag_moon_scaled", ssmgr->getFlagMoonScale());
1025
conf.set_double("viewing:light_pollution_luminance", lmgr->getAtmosphereLightPollutionLuminance());
1027
// Landscape section
1028
conf.set_boolean("landscape:flag_landscape", lmgr->getFlagLandscape());
1029
conf.set_boolean("landscape:flag_atmosphere", lmgr->getFlagAtmosphere());
1030
conf.set_boolean("landscape:flag_fog", lmgr->getFlagFog());
1031
// conf.set_double ("viewing:atmosphere_fade_duration", core->getAtmosphereFadeDuration());
1034
StarMgr* smgr = (StarMgr*)moduleMgr->getModule("StarMgr");
1035
conf.set_double ("stars:star_scale", smgr->getScale());
1036
conf.set_double ("stars:star_mag_scale", smgr->getMagScale());
1037
conf.set_boolean("stars:flag_point_star", smgr->getFlagPointStar());
1038
conf.set_double ("stars:max_mag_star_name", smgr->getMaxMagName());
1039
conf.set_boolean("stars:flag_star_twinkle", smgr->getFlagTwinkle());
1040
conf.set_double ("stars:star_twinkle_amount", smgr->getTwinkleAmount());
1041
conf.set_boolean("astro:flag_stars", smgr->getFlagStars());
1042
conf.set_boolean("astro:flag_star_name", smgr->getFlagNames());
1045
NebulaMgr* nmgr = (NebulaMgr*)moduleMgr->getModule("NebulaMgr");
1046
conf.set_str ("color:azimuthal_color", StelUtils::vec3f_to_str(grlmgr->getColorAzimutalGrid()).c_str());
1047
conf.set_str ("color:equatorial_color", StelUtils::vec3f_to_str(grlmgr->getColorEquatorGrid()).c_str());
1048
conf.set_str ("color:equator_color", StelUtils::vec3f_to_str(grlmgr->getColorEquatorLine()).c_str());
1049
conf.set_str ("color:ecliptic_color", StelUtils::vec3f_to_str(grlmgr->getColorEclipticLine()).c_str());
1050
conf.set_str ("color:meridian_color", StelUtils::vec3f_to_str(grlmgr->getColorMeridianLine()).c_str());
1051
conf.set_str ("color:nebula_label_color", StelUtils::vec3f_to_str(nmgr->getNamesColor()).c_str());
1052
conf.set_str ("color:nebula_circle_color", StelUtils::vec3f_to_str(nmgr->getCirclesColor()).c_str());
1053
conf.set_str ("color:cardinal_color", StelUtils::vec3f_to_str(lmgr->getColorCardinalPoints()).c_str());
1054
conf.set_str ("color:planet_names_color", StelUtils::vec3f_to_str(ssmgr->getNamesColor()).c_str());
1055
conf.set_str ("color:planet_orbits_color", StelUtils::vec3f_to_str(ssmgr->getOrbitsColor()).c_str());
1056
conf.set_str ("color:object_trails_color", StelUtils::vec3f_to_str(ssmgr->getTrailsColor()).c_str());
1059
conf.set_double("gui:mouse_cursor_timeout",getMouseCursorTimeout());
1060
conf.set_str ("gui:day_key_mode", getDayKeyMode().c_str());
1063
conf.set_boolean("tui:flag_show_gravity_ui", getFlagShowGravityUi());
1064
conf.set_boolean("tui:flag_show_tui_datetime", getFlagShowTuiDateTime());
1065
conf.set_boolean("tui:flag_show_tui_short_obj_info", getFlagShowTuiShortObjInfo());
1067
// Navigation section
1068
conf.set_boolean("navigation:flag_manual_zoom", mvmgr->getFlagManualAutoZoom());
1069
conf.set_double ("navigation:auto_move_duration", mvmgr->getAutoMoveDuration());
1070
conf.set_double ("navigation:zoom_speed", mvmgr->getZoomSpeed());
1071
conf.set_double ("navigation:preset_sky_time", core->getNavigation()->getPresetSkyTime());
1072
conf.set_str ("navigation:startup_time_mode", core->getNavigation()->getStartupTimeMode().c_str());
1075
conf.set_boolean("astro:flag_object_trails", ssmgr->getFlagTrails());
1076
conf.set_boolean("astro:flag_bright_nebulae", nmgr->getFlagBright());
1077
conf.set_boolean("astro:flag_nebula", nmgr->getFlagShow());
1078
conf.set_boolean("astro:flag_nebula_name", nmgr->getFlagHints());
1079
conf.set_double("astro:max_mag_nebula_name", nmgr->getMaxMagHints());
1080
conf.set_boolean("astro:flag_planets", ssmgr->getFlagPlanets());
1081
conf.set_boolean("astro:flag_planets_hints", ssmgr->getFlagHints());
1082
conf.set_boolean("astro:flag_planets_orbits", ssmgr->getFlagOrbits());
1084
MilkyWay* mw = (MilkyWay*)moduleMgr->getModule("MilkyWay");
1085
conf.set_boolean("astro:flag_milky_way", mw->getFlagShow());
1086
conf.set_double("astro:milky_way_intensity", mw->getIntensity());
1088
// Save observatory info
1089
core->getObservatory()->setConf(conf, "init_location");
1091
conf.save(confFile);