#########################################################################
##                                                                     ##
##  I N T E R S T E L L A R   C O N S O L E  Main GUI                  ##
##            Copyright (C) 2025- Misato Observatory, Wakayama, Japan  ##
##                                                                     ##
##  This software is available under the GPL (General Public License)  ##
##                                                                     ##
##       Tcl/Tk References: http://www.nct9.ne.jp/m_hiroi/tcl_tk_doc/  ##
##                                                                     ##
#########################################################################

#
#   特記事項
#
# - misato-gui.tcl, date-gui.tcl, media-gui.tcl が別のプロセスで動作
#   するのは Version 1.3e が最後。
#
# - Version 1.3f 以降では、全GUI が同一プロセスで動作し、date-gui.tcl, 
#   media-gui.tcl の GUI はサブウィンドウであるため、ウィンドウを閉じ
#   ても時刻表示系プログラムは動作し続け、時刻・フラグ系の変数が残る。
#   初期設定の「全」では date-gui.tcl, media-gui.tcl の GUI も初期化
#   される。開くことのできるウィンドウは１つである。
#
# - Version 1.4 以降では、GUI のレスポンス改善のため、date-gui.tcl 内
#   にあった scheduling 部を外部プロセス(isc-scheduler.tcl)で行うよう
#   にした。
#

####################################################################

#
# サーバURL, OS依存の定数, GUIの基本設定(フォント,色)をセット
#
source local-config.tcl

#
# 基本的procをインポートする
#
source -encoding $TCLSRC_ENCODING base-proc.tcl


####################################################################
##                                                                ##
##              G E N E R I C   P R O C E D U R E S               ##
##                                                                ##
####################################################################

# 天体情報取得の時だけ利用（http::geturlはiscserv.tclに対して使用不可）
#package require http

#
# ISC用 基本的procをインポートする
#
source -encoding $TCLSRC_ENCODING isc-proc.tcl

#
# ボタンウィジェット作成用 wrapper proc
# MacOS のボタンがダメダメな件の対策
#

#
# ボタンの作成 (code用)
#
proc create_button_code { arg_id arg_text arg_command } {

  global flag_using_ttk_button
  global font_codefield

  if { $flag_using_ttk_button == 0 } {
    # 通常のボタンを使用する (MacOSだと色が壊れる)
    button $arg_id -font $font_codefield -text $arg_text -command $arg_command
  } else {
    # ttkのボタンを使用する (MacOSでもOK)
    ttk::button $arg_id -style "Code.TButton" -text $arg_text -command $arg_command
  }

}

#
# タブとして使うボタンの状態を変化させる
#
proc configure_tab_button { arg_id flag_selected } {

  global flag_using_ttk_button
  global tab_background
  global tab_foreground
  global tab_selected_background
  global tab_selected_foreground

  # Tabのボタンは ttk::button 固定
  if { 1 } {
    if { $flag_selected == 0 } {
      $arg_id configure -style Tab.TButton
    } else {
      $arg_id configure -style SelectedTab.TButton
    }
  } else {
    if { $flag_selected == 0 } {
      $arg_id configure -bg $tab_background -fg $tab_foreground -relief raised
    } else {
      $arg_id configure -bg $tab_selected_background -fg $tab_selected_foreground -relief sunken
    }
  }

}

#
# 汎用: stellariumサーバ上の指定されたスクリプト(foo.ssc)を実行 (可変引数)
#
proc exec_ssc_on_server { args } {

  global stellarium_run_url stellarium_script_dir
  global buffer_codefield

  foreach script_file $args {

    set buffer_codefield $script_file

    do_http_post $stellarium_run_url "id=$stellarium_script_dir/$script_file" ret buffer_codefield
    set status [string trim $ret]

    if { $status ne "ok" } {
      set buffer_codefield "$script_file / ERROR: $status"
    }

  }

}

#
# 汎用: stellariumスクリプトn行 を送信 (可変引数)
#
#  【注意】
#    ・args[n] に空白を入れたい場合は [~] を、["] を入れたい場合は ['] とする。
#      例: "Ursa Major" は 'Ursa~Major' とする
#    ・送信できるのは、関数の羅列だけである。
#      Stellariumがクラッシュするため、for()文などの制御構文を送ってはならない。
#
proc send_ssc_lines { args } {

  global stellarium_direct_url
  global buffer_codefield

  foreach code1line $args {

    # replace [~] with [ ], and ['] with ["]
    set code_p0 [regsub -all {~} $code1line { }]
    set code_p1 [regsub -all {'} $code_p0 {"}]
    set str_code [string trim $code_p1]

    set buffer_codefield $str_code

    # send a code using POST
    do_http_post $stellarium_direct_url "code=$str_code" ret buffer_codefield

  }

}

#
# 超汎用: stellariumスクリプトn行 を送信
#         または
#         サーバ上の指定されたスクリプト(foo.ssc)を実行 (可変引数)
#
proc send_or_exec_ssc { args } {

  foreach code $args {

    set code_case [string tolower $code]
    if { [string match "*.ssc" $code_case] } {
      exec_ssc_on_server $code
    } else {
      send_ssc_lines $code
    }

  }

}

#
# 汎用: filename_text を読み込み、1行=1要素の配列を array_ret に返す
#
proc get_line_array_from_text_file { filename_text array_ret } {

  upvar $array_ret array_ref

  array set array_ref {}

  if { [catch {open $filename_text r} fid] } {
    # do nothing
  } else {
    set i 0
    while { [gets $fid line] >= 0 } {
      set s [string trim $line]
      # skip comments
      if { [string length $s] != 0 && [string index $s 0] ne "#" } {
        set array_ref($i) $s
        incr i
      }
    }
    close $fid
  }

}

#
# 汎用: ISC Server からファイル filename にある値をGETし、
#       連想配列を作って asarr_ret に返す
#       返り値はステータス  0: 正常  non-zero: エラー
#
proc get_data_from_iscserv { filename asarr_ret } {

  global iscserv_url
  global buffer_codefield
  upvar $asarr_ret asarr_ref

  set return_val -1

  do_http_get $iscserv_url/$filename ret_string buffer_codefield

  if { $ret_string eq "" } {
    # ERROR
    # wm state . normal
    # tk_messageBox -type ok -icon info -title "ERROR" -message "Unable to GET $iscserv_url/$filename"
  } else {
    set lines [split $ret_string "\n"]
    set len_lines [llength $lines]
    set flg_get 0
    for {set i 0} {$i < $len_lines} {incr i} {
      set txt_line [lindex $lines $i]
      set lst [split [string trim $txt_line] ","]
      if { [llength $lst] == 2 } {
        set k [string trim [lindex $lst 0]]
        set v [string trim [lindex $lst 1]]
        set asarr_ref($k) $v
        set flg_get 1
      }
    }
    if { $flg_get != 0 } {
      set return_val 0
    } else {
      # ERROR
      # wm state . normal
      # tk_messageBox -type ok -icon info -title "ERROR" -message "Unable to GET $iscserv_url/$filename"
    }
  }

  return $return_val

}


####################################################################
##                                                                ##
##                      P R O C E D U R E S                       ##
##                                                                ##
####################################################################

set stellarium_version ""
set stellarium_major_version ""

#
# ISC Server から Stellarium のバージョンを取得し、返す
#
proc get_stellarium_version {} {

  global gui_tsl
  global stellarium_version
  global iscserv_url
  global buffer_codefield

  if { $stellarium_version eq "" } {
    # ISC Server から Stellarium の Version を取得する
    do_http_get $iscserv_url/stellarium_version.isc.txt ret buffer_codefield
    if { $ret eq "" } {
      isc_dialog .dlg_isc_no_connection "ERROR" "$gui_tsl(DIALOG_ISC_NO_CONNECTION)" 0 ""  0 " OK " "" "" ""
      exit
    }
    set stellarium_version [string trim $ret]
  }

  return $stellarium_version

}

#
# ISC Server から Stellarium のメジャーバージョンを取得し、返す
#
proc get_stellarium_major_version {} {

  global gui_tsl
  global stellarium_major_version

  if { $stellarium_major_version eq "" } {
    set v [get_stellarium_version]
    set status [regexp -- {^([0-9]+)} $v match s2]
    if { $status == 1 } {
      set stellarium_major_version $s2
    }
  }

  if { $stellarium_major_version eq "unknown" } {
    isc_dialog .dlg_no_version "ERROR" "$gui_tsl(DIALOG_NO_VERSION)" 0 ""  0 " OK " "" "" ""
    exit
  }

  return $stellarium_major_version

}

#
# ISC Server から 星、天の川等の現在の値をGETし、
# 連想配列 asarr_initial_settings に格納する
#
#proc get_current_settings {} {
#
#  global asarr_initial_settings
#
#  # asarr_initial_settings is updated
#  get_data_from_iscserv $txt_current_settings_isc asarr_initial_settings
#
#}

#
# ISC Server から 星、天の川等の現在の値をGETし、
# 連想配列 asarr_ret に返す
#
proc get_current_settings_to { asarr_ret } {

  global txt_current_settings_isc
  upvar $asarr_ret asarr_ref

  set s [get_data_from_iscserv $txt_current_settings_isc asarr_ref]

  if { $s != 0 } {
    wm state . normal
    tk_messageBox -type ok -icon info -title "ERROR" -message "Unable to GET $txt_current_settings_isc"
  }

}

#
# ISC Server から MinFps の現在の値をGETし、
# 連想配列 asarr_ret に返す
#
proc get_current_min_fps_to { asarr_ret } {

  upvar $asarr_ret asarr_ref

  set s [get_data_from_iscserv "_tmp_currentMinFps.isc.txt" asarr_ref]

  if { $s != 0 } {
    wm state . normal
    tk_messageBox -type ok -icon info -title "ERROR" -message "Unable to GET _tmp_currentMinFps.isc.txt"
  }

}

#
# ISC Server から 星、天の川等の初期値をGETし、
# 連想配列 asarr_ret に返す
#
proc get_initial_settings_to { asarr_ret } {

  upvar $asarr_ret asarr_ref

  set s [get_data_from_iscserv "initialSettings.isc.txt" asarr_ref]

  if { $s != 0 } {
    wm state . normal
    tk_messageBox -type ok -icon info -title "ERROR" -message "Unable to GET initialSettings.isc.txt"
  }

}

#
# Stellarium から現在の動作モード(Dome or Navi)を取得
# 0: Navigationモード  1: Domeモード
#
proc get_flag_dome_mode_on_server {} {

  global ssc_get_current_settings

  # FlagDomeMode についてはサーバから最新情報を取得
  exec_ssc_on_server $ssc_get_current_settings
  after 500
  array set asarr_cnt_settings {}
  get_current_settings_to asarr_cnt_settings

  set v 0
  if { [string tolower $asarr_cnt_settings(FlagDomeMode)] eq "true" } {
    set v 1
  }

  return $v

}

#
# ISC Server 上で初期値を保存
#
proc save_current_to_initial_settings_on_iscserv {} {

  global txt_current_settings_isc
  global flag_host_gui
  global buffer_codefield

  if { $flag_host_gui != 0 } {

    set iscserv_root [get_stellarium_io_directory]

    set buffer_codefield "iscserv_root=$iscserv_root"

    # 設定ファイルをコピーする
    set buffer_codefield "copy: $txt_current_settings_isc -> initialSettings.isc.txt"
    file copy -force $iscserv_root/$txt_current_settings_isc $iscserv_root/initialSettings.isc.txt

  }

}


#
# ISC Server からラベルIDをGETし、連想配列 asarr_star_label を作る
#
proc get_star_label_id {} {

  global asarr_star_label

  # asarr_star_label is updated
  set s [get_data_from_iscserv "_tmp_starLabels.isc.txt" asarr_star_label]

  return $s

}

#
# 星ラベル(stellarium・GUI)の初期化 (更新には両サーバの再起動が必須)
#
# _tmp_starLabels.isc.txt は host 起動時 または モード切り替え時にのみ
# 生成される
#
proc initialize_star_labels { {flag_force_init 0} } {

  global flag_host_gui
  global asarr_star_label

  if { $flag_host_gui != 0 } {
    set s [get_star_label_id]
    if { $s != 0 || $flag_force_init != 0 } {
      send_ssc_lines "LabelMgr.deleteAllLabels()"
      exec_ssc_on_server createStarLabels.ssc
      after 500
    }
  }

  set s [get_star_label_id]
  if { $s != 0 } {
    wm state . normal
    tk_messageBox -type ok -icon info -title "ERROR" -message "Unable to GET _tmp_starLabels.isc.txt"
  } else {
    # 全ラベルを false にセット
    foreach {i} [array name asarr_star_label] {
      set v $asarr_star_label($i)
      send_ssc_lines "LabelMgr.setLabelShow($v,false)"
    }
  }

}

#
# GUI 初期化 (Configuration/Maintenance)
#
proc initialize_config_gui_params {} {

  send_ssc_of_projection_mode /
  send_ssc_of_display_gamma /
  send_ssc_of_view_fov /
  send_ssc_of_view_altitude /
  send_ssc_of_view_azimuth /
  send_ssc_of_viewport_x /
  send_ssc_of_viewport_y /
  send_ssc_of_disk_viewport /
  send_ssc_of_dso_fov_circular_marker /

}

#
# GUI 初期化 (すべて)
#
proc initialize_all_gui_params {} {

  send_ssc_of_timerate /
  send_ssc_of_milkyway /
  send_ssc_of_relative_star_scale /
  send_ssc_of_absolute_star_scale /
  send_ssc_of_landscape_transparency /
  send_ssc_of_meteor_zhr /
  send_ssc_of_min_fps /
  send_ssc_of_app_language /
  send_ssc_of_location_latitude /
  send_ssc_of_location_longitude /
  send_ssc_of_location_altitude /
  send_ssc_of_location_planet /
  send_ssc_of_stellarlabels /
  send_ssc_of_solsyslabels /
  send_ssc_of_solpscale /
  send_ssc_of_solmscale /
  send_ssc_of_solsscale /
  send_ssc_of_dsolabels /
  send_ssc_of_dsohints /

  initialize_config_gui_params

}

#
# 現在のstellarium上の設定値を取得し、GUIに反映
#
proc reload_all_gui_params {} {

  global ssc_get_current_settings
  global asarr_initial_settings

  # backup
  set tmp_array_list [array get asarr_initial_settings]

  exec_ssc_on_server $ssc_get_current_settings
  after 500
  get_current_settings_to asarr_initial_settings
  initialize_all_gui_params

  # restore
  array set asarr_initial_settings $tmp_array_list

}

#
# VIEW の値をテストする。NaN が見つかれば non-0 を返す
#  asarr_ret: 全てのパラメータ値が格納される
#
proc test_and_get_view_prms { asarr_ret } {

  global ssc_get_current_settings
  #global buffer_codefield

  upvar $asarr_ret asarr_ref

  # 設定値を取得
  after 500
  exec_ssc_on_server $ssc_get_current_settings
  after 500
  get_current_settings_to asarr_ref

  #set buffer_codefield ""

  set flg_found 0
  foreach {i} [array name asarr_ref] {
    set v $asarr_ref($i)
    # debug...
    #append buffer_codefield "$v,"
    #if { $i eq "TestKey" } {
    #  tk_dialog .dlg_test "TEST" "i,v = ($i),($v)" "" 0 "Yes"
    #}
    if { [string tolower $v] eq "nan" } {
      set flg_found 1
      break
    }
  }

  return $flg_found

}

#
# VIEW の値をテストする。NaN が見つかれば non-0 を返す
#
proc test_view_prms {} {

  array set asarr_current_settings {}

  set v [test_and_get_view_prms asarr_current_settings]

  return $v

}

#
# ビュー(stellarium・GUI)初期化
#  arg_flg_init_config_gui_prms: 1 をセットすると、最後に Configurationフレーム内パラメータを初期化
#  arg_displaying_dlg: ダイアログを表示中にこのprocを呼ぶ場合にその window ID をセット
#
proc send_ssc_to_initialize_view { arg_flg_init_config_gui_prms arg_flg_before_dso_zoom arg_displaying_dlg } {

  global gui_tsl
  global asarr_initial_settings
  global asarr_before_dso_zoom_settings
  global flag_dome_mode
  #global buffer_codefield

  array set asarr_current_settings {}

  # Recovering from view initialization failures

  set count_retry 0
  while { 1 } {

    exec_ssc_on_server localInitView.ssc

    # DSO zoom のリセットの場合の処理
    if { $arg_flg_before_dso_zoom != 0 } {
      set v $asarr_before_dso_zoom_settings(LandscapeMgr.flagLandscape)
      if { $v ne "-" } {
        send_ssc_lines "core.moveToAltAzi($asarr_before_dso_zoom_settings(ViewAltitude),$asarr_before_dso_zoom_settings(ViewAzimuth),0)"
      }
    }

    # もし値に NaN が見つかった場合、2秒おきに初期化をリトライする
    if { [test_and_get_view_prms asarr_current_settings] == 0 } {
      break
    } elseif { $count_retry < 3 } {
      after 2000
      incr count_retry
    } else {
      # このダイアログが出ることは、まず無いであろう
      if { $arg_displaying_dlg ne "-" } {
        set junk [catch {destroy $arg_displaying_dlg} wid]
      }
      set ans_retry [isc_dialog .dlg_retry_init "Question" "$gui_tsl(DIALOG_RETRY_INIT)" 1 ""  0 "$gui_tsl(DIALOG_RETRY_INIT_OPT_RETRY)" "$gui_tsl(DIALOG_RETRY_INIT_OPT_RESTART)" "" ""]
      if { $ans_retry != 0 } {
        if { $flag_dome_mode == 0 } {
          exec tclsh exec_isc.tcl -navi &
        } else {
          exec tclsh exec_isc.tcl -dome &
        }
      }
      set count_retry 0
    }

  }

  # DSO zoom 中にVIEWの初期化をした場合の処理
  if { $arg_flg_before_dso_zoom == 0 } {
    set asarr_before_dso_zoom_settings(ViewAltitude) $asarr_current_settings(ViewAltitude)
    set asarr_before_dso_zoom_settings(ViewAzimuth) $asarr_current_settings(ViewAzimuth)
  }

  # initialize GUI
  if { $arg_flg_init_config_gui_prms != 0 } {

    set asarr_initial_settings(ProjectionMode) $asarr_current_settings(ProjectionMode)
    set asarr_initial_settings(DisplayGamma) $asarr_current_settings(DisplayGamma)
    set asarr_initial_settings(ViewFov) $asarr_current_settings(ViewFov)
    set asarr_initial_settings(ViewAltitude) $asarr_current_settings(ViewAltitude)
    set asarr_initial_settings(ViewAzimuth) $asarr_current_settings(ViewAzimuth)
    set asarr_initial_settings(ViewportX) $asarr_current_settings(ViewportX)
    set asarr_initial_settings(ViewportY) $asarr_current_settings(ViewportY)
    set asarr_initial_settings(DiskViewport) $asarr_current_settings(DiskViewport)

    initialize_config_gui_params

  }

}

#
# Location(stellarium・GUI)初期化
#
proc send_ssc_to_initialize_location {} {

  global ssc_get_current_settings
  global asarr_initial_settings
  global flag_dome_mode
  array set asarr_current_settings {}

  # initialize location and timezone
  exec_ssc_on_server localInitLocation.ssc
  exec_ssc_on_server setLandscape.ssc

  exec_ssc_on_server $ssc_get_current_settings
  after 500
  get_current_settings_to asarr_current_settings

  # 新しい AppLanguage がきたら combobox に追加する
  set new_lang $asarr_current_settings(AppLanguage)
  set current_list [.cb_app_language cget -values]
  if { $new_lang in $current_list } {
    # OK
  } else {
    lappend current_list $new_lang
  }
  .cb_app_language configure -values $current_list

  set asarr_initial_settings(AppLanguage) $asarr_current_settings(AppLanguage)
  set asarr_initial_settings(Altitude) $asarr_current_settings(Altitude)
  set asarr_initial_settings(Longitude) $asarr_current_settings(Longitude)
  set asarr_initial_settings(Latitude) $asarr_current_settings(Latitude)
  set asarr_initial_settings(Planet) $asarr_current_settings(Planet)

  send_ssc_of_app_language /
  send_ssc_of_location_latitude /
  send_ssc_of_location_longitude /
  send_ssc_of_location_altitude /
  send_ssc_of_location_planet /

  if { $flag_dome_mode != 0 } {
    exec_ssc_on_server updateCardinal.ssc
  }

}

#
# 全オブジェクトを非表示にする
# (初期化時にグラフィックス処理を軽減するためのproc)
#
proc hide_all_objects { safe_init_factor } {

  # Stellarium-25.4 でのバグ対策
  # (症状: AsterismMgr.selectAllAsterisms(true)の後localInitSettings.sscを実行するとクラッシュする)
  # AsterismMgr.selectAllAsterisms(true) を使わなくなったためクラッシュ頻度は下がったが、
  # 念のため実行しておく
  #send_ssc_lines AsterismMgr.setFlagLines(false) AsterismMgr.setFlagLabels(false)
  send_ssc_lines AsterismMgr.setFlagIsolateAsterismSelected(true)
  send_ssc_lines AsterismMgr.deselectAsterisms() AsterismMgr.deselectAsterisms()

  set after_val [expr round(1.0 * 1300 * $safe_init_factor)]
  after $after_val

  # Mask stars
  send_ssc_lines StelSkyDrawer.setAbsoluteStarScale(0.0)
  send_ssc_lines MilkyWay.setIntensity(0.0) ZodiacalLight.setIntensity(0.0)
  send_ssc_lines StelSkyLayerMgr.setFlagShow(false)
  exec_ssc_on_server unsetSolarSystem.ssc 

  set after_val [expr round(1.0 * 200 * $safe_init_factor)]
  after $after_val

  # セットに時間がかかるもの
  unset_all_star_labels
  exec_ssc_on_server unsetConstellationAll.ssc
  if { 25 <= [get_stellarium_major_version] } {
    send_ssc_lines ConstellationMgr.setFlagZodiac(false)
  }
  send_ssc_lines MilkyWay.setFlagShow(false) ZodiacalLight.setFlagShow(false)
  send_ssc_lines SolarSystem.setFlagLabels(false) SolarSystem.setFlagOrbits(false)
  send_ssc_lines StarMgr.setFlagLabels(false) NebulaMgr.setFlagShow(false)
  send_ssc_lines SpecialMarkersMgr.setFlagFOVCircularMarker(false)
  send_ssc_lines LandscapeMgr.setFlagLandscape(false) LandscapeMgr.setFlagAtmosphere(false)
  # 以前のモードの方位表示を消去しておく
  exec_ssc_on_server unsetCardinal.ssc

  set after_val [expr round(1.0 * 1400 * $safe_init_factor)]
  after $after_val

  # すぐ消えるもの
  send_ssc_lines core.setSelectedObjectMarkerVisible(false) core.setSelectedObjectInfo('None')
  send_ssc_lines SporadicMeteorMgr.setFlagShow(false) MeteorShowers.setEnableMarker(false)
  exec_ssc_on_server unsetFlagGridLines.ssc

  # ISC関連画像を消去
  exec_ssc_on_server unsetEarthOrbit.ssc unsetEarthOrbitLabels.ssc
  exec_ssc_on_server unsetEclipticDateLabels.ssc unsetSunDiurnalMotion.ssc

}

set mtime_createStarLabels_ssc 0
set mtime_localConfig_ssc 0
set mtime_localInitLocation_ssc 0

#
# 全(stellarium・GUI)初期化
#  flag_dialog:
#   0: スプラッシュ付き (確認ダイアログ無し)
#   1: 確認ダイアログ無し
#   2: 確認ダイアログ有り
#
# VIEWを安定して初期化するのが難しいため、最初と最後で実施している。
#
proc send_ssc_to_initialize_all { flag_dialog {flag_mode_changed 0} } {

  global gui_tsl
  global app_languages
  global flag_host_gui
  global flag_dome_mode
  global flag_light_pollution_after_initialization
  global ssc_get_current_settings
  global asarr_initial_settings
  global asarr_before_dso_zoom_settings
  global isc_dialog_buffer_message
  global mtime_createStarLabels_ssc
  global mtime_localConfig_ssc
  global mtime_localInitLocation_ssc
  global flag_ruby_of_labels

  if { $flag_dialog == 0 } {
    set ans [isc_dialog .dlg_initializing "splash" "$gui_tsl(DIALOG_INITIALIZING)" 1 ""  0 "" "" "" ""]
  } else {
    if { 1 < $flag_dialog } {
      set ans_do [isc_dialog .dlg_initialize_all "Question" "$gui_tsl(DIALOG_INITIALIZE_ALL)" 0 ""  1 "$gui_tsl(DIALOG_INITIALIZE_ALL_OPT_OK)" "$gui_tsl(DIALOG_INITIALIZE_ALL_OPT_CANCEL)" "" ""]
      if { $ans_do == 1 } {
        return
      }
    }
    #                                             ____________________________________
    set ans [isc_dialog .dlg_initializing "progress" "$gui_tsl(DIALOG_INITIALIZING)" 0 ""  0 "" "" "" ""]
  }

  #
  # STEP-1: 時刻を止めてFPS値を設定、全オブジェクト非表示にする
  #

  #                              ____________________________________
  set isc_dialog_buffer_message "$gui_tsl(DIALOG_MSG_PROGRESS01)"
  update

  # Stop scheduler and screen time
  update_flags_for_scheduler 0
  send_ssc_lines core.setTimeRate(0.0)
  # Set MinFPS
  send_ssc_lines core.setMinFps(10.0)

  # SafeInitFactor を取得する
  array set asarr_current_min_fps {}
  exec_ssc_on_server getCurrentMinFps.ssc
  after 500
  get_current_min_fps_to asarr_current_min_fps

  # 全オブジェクトを非表示にする
  hide_all_objects $asarr_current_min_fps(SafeInitFactor)
  remove_all_sky_images

  set base_after_val 500
  set after_val [expr round(1.0 * $base_after_val * $asarr_current_min_fps(SafeInitFactor))]

  after $after_val

  #
  # STEP-2,3,4: モードをセットし、初期化する
  #

  #                              ____________________________________
  set isc_dialog_buffer_message "$gui_tsl(DIALOG_MSG_PROGRESS02)"
  update

  # 動作モードをセット。最初にこれが必須
  if { $flag_host_gui != 0 } {
    # set mode
    if { $flag_dome_mode == 0 } {
      exec_ssc_on_server unsetFlagDomeMode.ssc
    } else {
      exec_ssc_on_server setFlagDomeMode.ssc
    }
  }

  # 言語を先に設定する必要がある
  # Initialize Language, Location, and Timezone
  exec_ssc_on_server localInitLocation.ssc
  send_ssc_lines LandscapeMgr.setFlagLandscape(false);

  after $after_val

  set flag_ruby_of_labels 0
  update_gui_label_supported_ruby

  # initialize and create lables
  set flag_init_star_labels $flag_mode_changed
  #set flag_init_cardinal 0
  if { $flag_host_gui != 0 } {
    # Check timestamp
    set status0 [catch {set mt0 [file mtime createStarLabels.ssc] } ]
    set status1 [catch {set mt1 [file mtime localConfig.ssc] } ]
    set status2 [catch {set mt2 [file mtime localInitLocation.ssc] } ]
    if { $status0 == 0 && $status1 == 0 && $status2 == 0 } {
      if { $mt0 != $mtime_createStarLabels_ssc || $mt1 != $mtime_localConfig_ssc || $mt2 != $mtime_localInitLocation_ssc } {
        set flag_init_star_labels 1
      }
      #if { $mt2 != $mtime_localInitLocation_ssc } {
      #  set flag_init_cardinal 1
      #}
    }
    if { $status0 == 0 } {
      set mtime_createStarLabels_ssc $mt0
    }
    if { $status1 == 0 } {
      set mtime_localConfig_ssc $mt1
    }
    if { $status2 == 0 } {
      set mtime_localInitLocation_ssc $mt2
    }
  }
  initialize_star_labels $flag_init_star_labels

  if { $flag_dome_mode != 0 } {
    exec_ssc_on_server updateCardinal.ssc
  }

  set isc_dialog_buffer_message "$gui_tsl(DIALOG_MSG_PROGRESS03)"
  update

  # VIEW初期化
  # (Recovering from view initialization failures)
  # ここでは getCurrentSettings.ssc も実行される
  send_ssc_to_initialize_view 0 0 .dlg_initializing

  after $after_val

  #                              ____________________________________
  set isc_dialog_buffer_message "$gui_tsl(DIALOG_MSG_PROGRESS04)"
  update

  # Mask stars ...
  send_ssc_lines LandscapeMgr.setFlagAtmosphere(true) StelSkyDrawer.setLightPollutionLuminance(0.01)
  # 大気の表示に１秒はかかるので待つ
  after $after_val
  after $after_val

  #                              ____________________________________
  set isc_dialog_buffer_message "$gui_tsl(DIALOG_MSG_PROGRESS05)"
  update

  # 全基本設定を初期化
  exec_ssc_on_server localInitSettings.ssc

  # 光害を設定
  after $after_val
  if { $flag_light_pollution_after_initialization != 0 } {
    exec_ssc_on_server setLightPollution.ssc setLandscape.ssc
  } else {
    exec_ssc_on_server unsetLightPollution.ssc setLandscape.ssc
  }

  # 設定値を取得
  after $after_val
  exec_ssc_on_server $ssc_get_current_settings
  after $after_val
  get_current_settings_to asarr_initial_settings

  # 新しい AppLanguage がきたら combobox に追加する
  set new_lang $asarr_initial_settings(AppLanguage)
  set current_list [.cb_app_language cget -values]
  if { $new_lang in $current_list } {
    # OK
  } else {
    lappend current_list $new_lang
  }
  .cb_app_language configure -values $current_list

  #
  initialize_all_gui_params

  # initialize date-gui
  initialize_date_gui

  # initialize media-gui
  initialize_media_gui

  if { $flag_host_gui != 0 } {
    save_current_to_initial_settings_on_iscserv
  }

  # DSO zoom 実行前の設定保持をリセット
  set asarr_before_dso_zoom_settings(LandscapeMgr.flagLandscape) "-"

  # 「全初期化中...」ウィンドウのクローズ
  set junk [catch {destroy .dlg_initializing} wid]

  return

}

#
# スタンバイモードへ移行し、ダイアログで 終了 / モード切替 / GUI再起動 / 復帰
# を選択させる
# リモートマシンで MinFps 値が変更された場合、ダイアログを閉じる
#

# private proc (コールバックproc から呼ばれる)
proc proc_for_callback_exit_or_reboot { top } {

  global isc_dialog_destroy_flag

  array set asarr_current_min_fps {}

  get_current_min_fps_to asarr_current_min_fps

  set v $asarr_current_min_fps(MinFps)

  if { 1.0 <= $v } {
    set junk [catch {destroy $top} wid]
    # 大域変数で呼び出し元に知らせる
    set isc_dialog_destroy_flag 1
  } else {
    after 1000 callback_exit_or_reboot $top
  }

}

# private proc (コールバック):
#  ダイアログが閉じられたか、MinFps値が1.0以上になったら知らせる
proc callback_exit_or_reboot { top } {

  global isc_dialog_destroy_flag

  #array set asarr_current_settings {}

  # ダイアログが存在するかを判定
  if { [catch {toplevel $top} wid] } {

    exec_ssc_on_server getCurrentMinFps.ssc
    after 500 proc_for_callback_exit_or_reboot $top

    # 以下のコードでも動くが「after 500」が GUI の邪魔をするので↑のコードにした

    #exec_ssc_on_server $ssc_get_current_settings
    #after 500
    #get_current_settings_to asarr_current_settings

    #set v $asarr_current_settings(MinFps)

    #if { 1.0 <= $v } {
    #  set junk [catch {destroy $top} wid]
    #  # 大域変数で呼び出し元に知らせる
    #  set isc_dialog_destroy_flag 1
    #} else {
    #  after 1000 callback_exit_or_reboot $top
    #}

  } else {

    set junk [catch {destroy $top} wid]
    # 大域変数で呼び出し元に知らせる
    set isc_dialog_destroy_flag 1

  }

}

# 本体 1
proc exit_or_reboot {} {

  global gui_tsl

  global flag_dome_mode
  global buffer_timerate
  global buffer_min_fps
  global asarr_initial_settings

  array set asarr_current_min_fps {}

  set min_fps_standby "0.2"

  send_ssc_of_timerate 0.0

  # Stellariumのバグ対策:
  #  もし値が壊れているとここでダイアログが出てしまうのでコメントアウト
  #reload_all_gui_params

  set bak_min_fps $buffer_min_fps

  send_ssc_lines "core.setMinFps($min_fps_standby)"

  set bak_init_min_fps $asarr_initial_settings(MinFps)
  set asarr_initial_settings(MinFps) $min_fps_standby
  send_ssc_of_min_fps /
  set asarr_initial_settings(MinFps) $bak_init_min_fps

  set_flag_date_gui_standby 1

  set ans [isc_dialog .dlg_stdby_mode "Standby mode: Exit?" "$gui_tsl(DIALOG_STANDBY_MODE)" 0 "callback_exit_or_reboot"  3 "$gui_tsl(DIALOG_OPT_EXIT_ALL)" "$gui_tsl(DIALOG_OPT_CHANGE_NAVI_DOME)" "$gui_tsl(DIALOG_OPT_REBOOT_GUI)" "$gui_tsl(DIALOG_OPT_CANCEL)"]

  if { $ans == 0 } {
    send_ssc_lines "core.setMinFps($bak_min_fps)"
    exec tclsh exec_isc.tcl -kill &
  } elseif { $ans == 1 } {
    send_ssc_lines "core.setMinFps($bak_min_fps)"
    remove_all_sky_images
    exec tclsh exec_isc.tcl -gui-only &
  } elseif { $ans == 2 } {
    send_ssc_lines "core.setMinFps($bak_min_fps)"
    remove_all_sky_images
    if { $flag_dome_mode == 0 } {
      exec tclsh exec_isc.tcl -gui-only -navi &
    } else {
      exec tclsh exec_isc.tcl -gui-only -dome &
    }
  } else {
    set_flag_date_gui_standby 0
    exec_ssc_on_server getCurrentMinFps.ssc
    after 500
    get_current_min_fps_to asarr_current_min_fps
    if { $asarr_current_min_fps(MinFps) < 1.0 } {
      set buffer_min_fps $bak_min_fps
    } else {
      set buffer_min_fps $asarr_current_min_fps(MinFps)
    }
    send_ssc_of_min_fps
    #
    #reload_all_gui_params
    #if { $buffer_min_fps < 1.0 } {
    #  set buffer_min_fps $bak_min_fps
    #  send_ssc_of_min_fps
    #}
  }

}

# 本体 2
proc urgent_exit_or_reboot {} {

  global gui_tsl
  global flag_dome_mode

  set ans [isc_dialog .dlg_urgent_exit "Urgent Exit" "$gui_tsl(DIALOG_URGENT_EXIT)" 1 ""  3 "$gui_tsl(DIALOG_OPT_EXIT_ALL)" "$gui_tsl(DIALOG_OPT_CHANGE_NAVI_DOME)" "$gui_tsl(DIALOG_OPT_REBOOT_GUI)" "$gui_tsl(DIALOG_OPT_CANCEL)"]

  if { $ans == 0 } {
    exec tclsh exec_isc.tcl -kill &
  } elseif { $ans == 1 } {
    remove_all_sky_images
    exec tclsh exec_isc.tcl -gui-only &
  } elseif { $ans == 2 } {
    remove_all_sky_images
    if { $flag_dome_mode == 0 } {
      exec tclsh exec_isc.tcl -gui-only -navi &
    } else {
      exec tclsh exec_isc.tcl -gui-only -dome &
    }
  }

}


#                                        #
# ここからのprocは特定のウィジェット専用 #
#                                        #

#
# 星座の内部フラグ類を初期化する（グループリセット）
#   flag_all = 1 で全リセット
#
proc reset_constellation { {flag_all 1} } {

  if { $flag_all != 0 } {
    # よくわからないが、deselectAsterisms() を2回呼び出す事で安定するようになる
    send_ssc_lines AsterismMgr.setFlagIsolateAsterismSelected(true) AsterismMgr.deselectAsterisms() AsterismMgr.deselectAsterisms()
    after 500
  }

  if { 25 <= [get_stellarium_major_version] } {
    send_ssc_lines ConstellationMgr.setFlagZodiac(false)
  }

  if { $flag_all != 0 } {
    send_ssc_of_stellarlabels -
  }

  send_ssc_lines ConstellationMgr.setFlagBoundaries(false) ConstellationMgr.setFlagArt(false) ConstellationMgr.setFlagLines(false) ConstellationMgr.setFlagLabels(false) 
  exec_ssc_on_server unsetConstellationAll.ssc

  update_star_labels_by_group false fixedstars

}

# 星座名変換テーブル (Stellarium v25.1-)
array set asarr_native_to_english {
  "Aquila" "Eagle"
  "Andromeda" "Andromeda"
  "Sculptor" "Sculptor"
  "Ara" "Altar"
  "Libra" "Scales"
  "Cetus" "Whale"
  "Aries" "Ram"
  "Scutum" "Shield"
  "Pyxis" "Mariner Compass"
  "Bootes" "Bootes"
  "Caelum" "Engraving Tool"
  "Chamaeleon" "Chameleon"
  "Cancer" "Crab"
  "Capricornus" "Capricornus"
  "Carina" "Keel"
  "Cassiopeia" "Cassiopeia"
  "Centaurus" "Centaur"
  "Cepheus" "Cepheus"
  "Coma Berenices" "Bernice's Hair"
  "Canes Venatici" "Hunting Dogs"
  "Auriga" "Charioteer"
  "Columba" "Dove"
  "Circinus" "Drawing Compass"
  "Crater" "Cup"
  "Corona Australis" "Southern Crown"
  "Corona Borealis" "Northern Crown"
  "Corvus" "Crow"
  "Crux" "Southern Cross"
  "Cygnus" "Swan"
  "Delphinus" "Dolphin"
  "Dorado" "Swordfish"
  "Draco" "Dragon"
  "Norma" "Carpenter's Square"
  "Eridanus" "Eridanus"
  "Sagitta" "Arrow"
  "Fornax" "Furnace"
  "Gemini" "Twins"
  "Camelopardalis" "Giraffe"
  "Canis Major" "Greater Dog"
  "Ursa Major" "Great Bear"
  "Grus" "Crane"
  "Hercules" "Hercules"
  "Horologium" "Clock"
  "Hydra" "Water Snake"
  "Hydrus" "Lesser Water Snake"
  "Indus" "Indian"
  "Lacerta" "Lizard"
  "Monoceros" "Unicorn"
  "Lepus" "Hare"
  "Leo" "Lion"
  "Lupus" "Wolf"
  "Lynx" "Lynx"
  "Lyra" "Lyre"
  "Antlia" "Air Pump"
  "Microscopium" "Microscope"
  "Musca" "Fly"
  "Octans" "Octant"
  "Apus" "Bird of Paradise"
  "Ophiuchus" "Serpent Bearer"
  "Orion" "Orion"
  "Pavo" "Peacock"
  "Pegasus" "Pegasus"
  "Pictor" "Painter's Easel"
  "Perseus" "Perseus"
  "Equuleus" "Little Horse"
  "Canis Minor" "Lesser Dog"
  "Leo Minor" "Lesser Lion"
  "Vulpecula" "Fox"
  "Ursa Minor" "Lesser Bear"
  "Phoenix" "Phoenix"
  "Pisces" "Fishes"
  "Piscis Austrinus" "Southern Fish"
  "Volans" "Flying Fish"
  "Puppis" "Stern"
  "Reticulum" "Reticle"
  "Sagittarius" "Archer"
  "Scorpius" "Scorpion"
  "Serpens" "Serpent"
  "Sextans" "Sextant"
  "Mensa" "Table Mountain"
  "Taurus" "Bull"
  "Telescopium" "Telescope"
  "Tucana" "Toucan"
  "Triangulum" "Triangle"
  "Triangulum Australe" "Southern Triangle"
  "Aquarius" "Water Bearer"
  "Virgo" "Maiden"
  "Vela" "Sails"
}

# Bootes: ¨付きの o が使われた場合のサポート
# (Bootes か Bo¨otes かは skycultures による)
set asarr_native_to_english(Boootes) [format "Bo%c%ctes" 0xC3 0xB6]

#
# 星座のセレクト/アンセレクト
#
#  【注意】name に空白を入れたい場合は ~ とすること
#          例: "Ursa Major" は "Ursa~Major" とする
#
proc update_constellations { flg args } {

  global stellarium_direct_url
  global buffer_codefield
  global asarr_native_to_english

  foreach name0 $args {

    # replace '~' with ' '
    set arg_name_native [regsub -all {~} $name0 { }]
    set arg_name1 ""

    if { 25 <= [get_stellarium_major_version] } {
      # native to english (v25.1-)
      set arg_name $asarr_native_to_english($arg_name_native)
      if { $arg_name_native eq "Bootes" } {
        set arg_name1 $asarr_native_to_english(Boootes)
      }
    } else {
      set arg_name $arg_name_native
    }

    # for Boootes
    if { $arg_name1 ne "" } {
      if { [string is true $flg] } {
        set str_code "ConstellationMgr.selectConstellation(\"$arg_name1\")"
      } else {
        set str_code "ConstellationMgr.deselectConstellation(\"$arg_name1\")"
      }
      do_http_post $stellarium_direct_url "code=$str_code" ret buffer_codefield
    }

    if { [string is true $flg] } {
      set str_code "ConstellationMgr.selectConstellation(\"$arg_name\")"
    } else {
      set str_code "ConstellationMgr.deselectConstellation(\"$arg_name\")"
    }

    set buffer_codefield $str_code

    # send a code using POST
    do_http_post $stellarium_direct_url "code=$str_code" ret buffer_codefield

  }

}

#
# アステリズムをセレクト/アンセレクト
#
#  【注意】name に空白を入れたい場合は ~ とすること
#
proc update_asterisms { flg args } {

  foreach name0 $args {
    if { [string is true $flg] } {
      send_ssc_lines AsterismMgr.setFlagIsolateAsterismSelected(true) AsterismMgr.selectAsterism('$name0') AsterismMgr.setFlagLines(true)
    } else {
      send_ssc_lines AsterismMgr.setFlagIsolateAsterismSelected(true) AsterismMgr.deselectAsterism('$name0')
    }
  }

}

#
# 方角ラベルのON
#
proc set_cardinal {} {

  global flag_ruby_of_labels

  if { $flag_ruby_of_labels != 0 } {
    exec_ssc_on_server setCardinalWithRuby.ssc
  } else {
    exec_ssc_on_server setCardinal.ssc
  }

}

#
# 1つまたは複数の星ラベルのON/Off (flag=true/false)
#
proc update_star_labels { flag args } {

  global asarr_star_label
  global flag_ruby_of_labels
  global buffer_cb_app_language

  if { [array size asarr_star_label] == 0 } {
    initialize_star_labels
  }

  # remove $args labels
  foreach name0 $args {
    set exp_str "^${name0}\[.\]" 
    set keys [array names asarr_star_label -regexp $exp_str]
    foreach name1 $keys {
      send_ssc_lines "LabelMgr.setLabelShow($asarr_star_label($name1),false)"
    }
    send_ssc_lines "LabelMgr.setLabelShow($asarr_star_label($name0),false)"
  }

  if { [string is true $flag] == 0 } {
    return
  }

  # set $args labels
  if { $buffer_cb_app_language eq "ja_JP" || $buffer_cb_app_language eq "KANA" } {
    foreach name0 $args {
      set name0_ruby "${name0}.ja^"
      set name0_ja "${name0}.ja"
      if { [info exists asarr_star_label($name0_ruby)] } {
        # ルビ存在あり
        if { $flag_ruby_of_labels != 0 } {
          send_ssc_lines "LabelMgr.setLabelShow($asarr_star_label($name0_ruby),true)"
        } else {
          send_ssc_lines "LabelMgr.setLabelShow($asarr_star_label($name0_ja),true)"
        }
      } else {
        # ルビ存在なし
        send_ssc_lines "LabelMgr.setLabelShow($asarr_star_label($name0_ja),true)"
      }
    }
  } else {
    foreach name0 $args {
      set lang [string range $buffer_cb_app_language 0 1]
      set name0_lang "${name0}.${lang}"
      if { [info exists asarr_star_label($name0_lang)] } {
        send_ssc_lines "LabelMgr.setLabelShow($asarr_star_label($name0_lang),true)"
      } else {
        send_ssc_lines "LabelMgr.setLabelShow($asarr_star_label($name0),true)"
      }
    }
  }

}

#
# 全ての星ラベルのOff
#
proc unset_all_star_labels {} {

  global asarr_star_label

  if { [array size asarr_star_label] != 0 } {
    # 全ラベルを false にセット
    foreach {i} [array name asarr_star_label] {
      set v $asarr_star_label($i)
      send_ssc_lines "LabelMgr.setLabelShow($v,false)"
    }
  }

}

#
# group_name で指定した星ラベルを set / unset (flag=true/false) する
#
proc update_star_labels_by_group { flag group_name } {

  set group_solarsystem {Sun Moon Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune Pluto}
  set group_spring {Polaris Mizar Spica Arcturus Regulus Denebola CorCaroli RigilKentaurus Acrux}
  set group_summer {Polaris Vega Altair Deneb Albireo Antares}
  set group_autumn {Polaris Fomalhaut Diphda Alpheratz Mira}
  set group_winter {Polaris M45 Betelgeuse Rigel Sirius Procyon Pollux Castor Capella Aldebaran Canopus}

  if { $group_name eq "solarsystem" } {
    update_star_labels $flag {*}$group_solarsystem
  } elseif { $group_name eq "spring" } {
    update_star_labels $flag {*}$group_spring
  } elseif { $group_name eq "summer" } {
    update_star_labels $flag {*}$group_summer
  } elseif { $group_name eq "autumn" } {
    update_star_labels $flag {*}$group_autumn
  } elseif { $group_name eq "winter" } {
    update_star_labels $flag {*}$group_winter
  } elseif { $group_name eq "fixedstars" } {
    update_star_labels $flag {*}$group_spring
    update_star_labels $flag {*}$group_summer
    update_star_labels $flag {*}$group_autumn
    update_star_labels $flag {*}$group_winter
  } elseif { $group_name eq "all" } {
    if { [string is true $flag] } {
      update_star_labels $flag {*}$group_solarsystem
      update_star_labels $flag {*}$group_spring
      update_star_labels $flag {*}$group_summer
      update_star_labels $flag {*}$group_autumn
      update_star_labels $flag {*}$group_winter
    } else {
      unset_all_star_labels
    }
  }

}

#
# stellariumスクリプトを送信または実行
# (SSC送信コード入力フィールド専用)
#
proc send_ssc_from_codefield {} {

  global buffer_codefield

  set buffer_codefield [string trim $buffer_codefield]

  if { ![string match "http*:*" $buffer_codefield] } {
    send_or_exec_ssc "$buffer_codefield"
  }

}

#
# send_ssc_of_xxxx 共通の仕様:
#
#  ・"/" が与えられた場合、初期値を GUI にセットし、stellarium に送信しない
#  ・"-" が与えられた場合、0もしくは初期値(ボタンによる)をセットし、stellarium に送信する
#

#
# 時刻レートを stellariumサーバへ送信
#
proc send_ssc_of_timerate { args } {

  global buffer_timerate
  global asarr_initial_settings

  set prm ""
  foreach p $args {
    set prm $p
    set prm_idx0 [string index $p 0]
    if { $prm eq "/" } {
      set v $asarr_initial_settings(TimeRate)
    } elseif { $prm eq "-" } {
      set v 0.0
    } elseif { $prm_idx0 eq "+" || $prm_idx0 eq "-" } {
      set v [expr $buffer_timerate + $prm]
    } else {
      set v $prm
    }
    set buffer_timerate $v
  }

  set v [string trim $buffer_timerate]
  set buffer_timerate [format "%.1f" $v]

  if { $prm ne "/" } {
    send_ssc_lines "core.setTimeRate($buffer_timerate)"
  }

}

#
# 時刻を stellariumサーバへ送信
#
proc send_ssc_from_timearg { args } {

  global buffer_datearg

  set tm_strreal [clock format [clock seconds] -format {%Y-%m-%dT%H:%M:%S}]
  set tm_str0 [clock format [clock seconds] -format {%Y-%m-%dT}]

  set buffer_datearg $tm_strreal

  foreach prm $args {
    set buffer_datearg $tm_str0
    append buffer_datearg $prm
  }

  send_ssc_lines "core.setDate('$buffer_datearg','local')"

}

#
# 時刻設定sscスクリプトを buffer_codefield にセット
#
proc set_buffer_codefield_from_buffer_datearg {} {

  global buffer_codefield
  global buffer_datearg

  set buffer_codefield "core.setDate(\"$buffer_datearg\",\"local\")"

}

#
# 散在流星ZHRを stellariumサーバへ送信
#
proc send_ssc_of_meteor_zhr { args } {

  global buffer_meteor_zhr
  global asarr_initial_settings

  set flg_show "true"
  set prm ""
  foreach p $args {
    set prm $p
    if { $prm eq "/" } {
      set v $asarr_initial_settings(SporadicMeteorMgr.ZHR)
    } elseif { $prm eq "-" } {
      set v 0
      set flg_show "false"
    } else {
      set v [expr $buffer_meteor_zhr + $prm]
    }
    set buffer_meteor_zhr $v
  }

  set v [string trim $buffer_meteor_zhr]
  if { $v < 0.0 } {
    set v 0
  }
  set buffer_meteor_zhr [format "%.0f" $v]

  if { $prm ne "/" } {
    send_ssc_lines "SporadicMeteorMgr.setFlagShow($flg_show)"
    send_ssc_lines "SporadicMeteorMgr.setZHR($buffer_meteor_zhr)"
  }

}

#
# 星ラベルのフラグ・量を stellariumサーバへ送信
#
proc send_ssc_of_stellarlabels { args } {

  global buffer_stellarlabels
  global asarr_initial_settings

  set flg_labels "true"
  set prm ""
  foreach p $args {
    set prm $p
    if { $prm eq "/" } {
      set v $asarr_initial_settings(StarMgr.labelsAmount)
    } elseif { $prm eq "-" } {
      set v 0.0
      set flg_labels "false"
    } else {
      set v [expr $buffer_stellarlabels + $prm]
    }
    set buffer_stellarlabels $v
  }

  set v [string trim $buffer_stellarlabels]
  if { $v < 0.0 } {
    set v 0.0
  }
  set buffer_stellarlabels [format "%.1f" $v]

  if { $prm ne "/" } {
    send_ssc_lines "StarMgr.setFlagLabels($flg_labels)"
    send_ssc_lines "StarMgr.setLabelsAmount($buffer_stellarlabels)"
  }

}

#
# 太陽系の内部フラグ類を初期化する（グループリセット）
#
proc reset_solarsystem {} {

  send_ssc_of_solsyslabels -

  if { 25 <= [get_stellarium_major_version] } {
    exec_ssc_on_server unsetEarthOrbitLabels.ssc unsetEarthOrbit.ssc initPlanetaryOrbits.ssc
  } else {
    send_ssc_lines SolarSystem.setFlagOrbits(false)
  }

  exec_ssc_on_server unsetEarthOrbitLabels.ssc unsetEarthOrbit.ssc

  send_ssc_of_solpscale -
  send_ssc_of_solmscale -
  send_ssc_of_solsscale -

  update_star_labels_by_group false solarsystem

}

#
# 太陽系を非表示にする
#
proc unset_solarsystem { args } {

  update_star_labels_by_group false solarsystem

  set flg 0
  foreach prm $args {
    exec_ssc_on_server unsetSolarSystemLightPollution.ssc setLandscape.ssc
    set flg 1
  }

  if { $flg == 0 } {
    exec_ssc_on_server unsetSolarSystem.ssc updateLightMoonPollution.ssc
  }

}

#
# 太陽系ラベルのフラグ・量を stellariumサーバへ送信
#
proc send_ssc_of_solsyslabels { args } {

  global buffer_solsyslabels
  global asarr_initial_settings

  set flg_labels "true"
  set prm ""
  foreach p $args {
    set prm $p
    if { $prm eq "/" } {
      set v $asarr_initial_settings(SolarSystem.labelsAmount)
    } elseif { $prm eq "-" } {
      set v 0.0
      set flg_labels "false"
    } else {
      set v [expr $buffer_solsyslabels + $prm]
    }
    set buffer_solsyslabels $v
  }

  set v [string trim $buffer_solsyslabels]
  if { $v < 0.0 } {
    set v 0.0
  }
  set buffer_solsyslabels [format "%.1f" $v]

  if { $prm ne "/" } {
    send_ssc_lines "SolarSystem.setFlagLabels($flg_labels)"
    send_ssc_lines "SolarSystem.setLabelsAmount($buffer_solsyslabels)"
  }

}

#
# 惑星サイズのフラグ・量を stellariumサーバへ送信
#
proc send_ssc_of_solpscale { args } {

  global buffer_solpscale
  global asarr_initial_settings

  set flg_pscale "true"
  set prm ""
  foreach p $args {
    set prm $p
    set prm_idx0 [string index $prm 0]
    if { $prm eq "/" } {
      set v $asarr_initial_settings(SolarSystem.planetScale)
    } elseif { $prm eq "-" } {
      set v 1.0
      set flg_pscale "false"
    } elseif { $prm_idx0 eq "+" } {
      set v [expr $buffer_solpscale * $prm]
    } else {
      set v $prm
    }
    set buffer_solpscale $v
  }

  set v [string trim $buffer_solpscale]
  if { $v < 1.0 } {
    set v 1.0
  } elseif { 6400.0 < $v } {
    set v 6400.0
  }
  set buffer_solpscale [format "%.0f" $v]

  if { $prm ne "/" } {
    send_ssc_lines "SolarSystem.setFlagPlanetScale($flg_pscale)"
    send_ssc_lines "SolarSystem.setPlanetScale($buffer_solpscale)"
  }

}

#
# 月サイズのフラグ・量を stellariumサーバへ送信
#
# "月1x" "exec_ssc_on_server setMoonScale1x.ssc"
# "初"   "exec_ssc_on_server localInitMoonScale.ssc"
# "32x"  "send_ssc_lines SolarSystem.setFlagDrawMoonHalo(false) SolarSystem.setFlagMoonScale(true) SolarSystem.setMoonScale(32)"
#
proc send_ssc_of_solmscale { args } {

  global buffer_solmscale
  global asarr_initial_settings

  set flg_mscale "true"
  set prm ""
  foreach p $args {
    set prm $p
    set prm_idx0 [string index $prm 0]
    if { $prm eq "/" } {
      set v $asarr_initial_settings(SolarSystem.moonScale)
    } elseif { $prm eq "%" } {
      set v 1.0
      set flg_mscale "false"
    } elseif { $prm eq "-" } {
      set v $asarr_initial_settings(SolarSystem.moonScale)
    } elseif { $prm_idx0 eq "+" } {
      set v [expr $buffer_solmscale * $prm]
    } else {
      set v $prm
    }
    set buffer_solmscale $v
  }

  set v [string trim $buffer_solmscale]
  if { $v < 1.0 } {
    set v 1.0
  } elseif { 128.0 < $v } {
    set v 128.0
  }
  set buffer_solmscale [format "%.0f" $v]

  if { $prm ne "/" } {
    if { $flg_mscale eq "false" } {
      exec_ssc_on_server setMoonScale1x.ssc
    } else {
      send_ssc_lines SolarSystem.setFlagDrawMoonHalo(false) SolarSystem.setFlagMoonScale($flg_mscale) SolarSystem.setMoonScale($buffer_solmscale)
    }
  }

}

#
# 太陽サイズのフラグ・量を stellariumサーバへ送信
#
# "太1x" "exec_ssc_on_server setSunScale1x.ssc"
# "初"   "exec_ssc_on_server localInitSunScale.ssc"
# "32x"  "send_ssc_lines SolarSystem.setFlagDrawSunHalo(false) SolarSystem.setFlagSunScale(true) SolarSystem.setSunScale(32)"
#
proc send_ssc_of_solsscale { args } {

  global buffer_solsscale
  global asarr_initial_settings

  set flg_sscale "true"
  set prm ""
  foreach p $args {
    set prm $p
    set prm_idx0 [string index $prm 0]
    if { $prm eq "/" } {
      set v $asarr_initial_settings(SolarSystem.sunScale)
    } elseif { $prm eq "%" } {
      set v 1.0
      set flg_sscale "false"
    } elseif { $prm eq "-" } {
      set v $asarr_initial_settings(SolarSystem.sunScale)
    } elseif { $prm_idx0 eq "+" } {
      set v [expr $buffer_solsscale * $prm]
    } else {
      set v $prm
    }
    set buffer_solsscale $v
  }

  set v [string trim $buffer_solsscale]
  if { $v < 1.0 } {
    set v 1.0
  } elseif { 128.0 < $v } {
    set v 128.0
  }
  set buffer_solsscale [format "%.0f" $v]

  if { $prm ne "/" } {
    if { $flg_sscale eq "false" } {
      exec_ssc_on_server setSunScale1x.ssc
    } else {
      send_ssc_lines SolarSystem.setFlagDrawSunHalo(false) SolarSystem.setFlagSunScale($flg_sscale) SolarSystem.setSunScale($buffer_solsscale)
    }
  }

}

#
# 天の川の光量を stellariumサーバへ送信
#
proc send_ssc_of_milkyway { args } {

  global asarr_initial_settings
  global buffer_milkyway

  set prm ""
  foreach p $args {
    set prm $p
    if { $prm eq "-" || $prm eq "/" } {
      set v $asarr_initial_settings(MilkyWay.intensity)
    } else {
      set v [expr $buffer_milkyway + $prm]
    }
    set buffer_milkyway $v
  }

  set v [string trim $buffer_milkyway]
  if { $v < 0.0 } {
    set v 0.0
  }
  set buffer_milkyway [format "%.1f" $v]

  if { $prm ne "/" } {
    send_ssc_lines "MilkyWay.setIntensity($buffer_milkyway)"
  }

}

#
# 星表現 相対パラメータを stellariumサーバへ送信
#
proc send_ssc_of_relative_star_scale { args } {

  global asarr_initial_settings
  global buffer_relative_star_scale

  set prm ""
  foreach p $args {
    set prm $p
    if { $prm eq "-" || $prm eq "/" } {
      set v $asarr_initial_settings(StelSkyDrawer.relativeStarScale)
    } else {
      set v [expr $buffer_relative_star_scale + $prm]
    }
    set buffer_relative_star_scale $v
  }

  set v [string trim $buffer_relative_star_scale]
  if { $v < 0.0 } {
    set v 0.0
  }
  set buffer_relative_star_scale [format "%.2f" $v]

  if { $prm ne "/" } {
    send_ssc_lines "StelSkyDrawer.setRelativeStarScale($buffer_relative_star_scale)"
  }

}

#
# 星表現 絶対パラメータを stellariumサーバへ送信
#
proc send_ssc_of_absolute_star_scale { args } {

  global asarr_initial_settings
  global buffer_absolute_star_scale

  set prm ""
  foreach p $args {
    set prm $p
    if { $prm eq "-" || $prm eq "/" } {
      set v $asarr_initial_settings(StelSkyDrawer.absoluteStarScale)
    } else {
      set v [expr $buffer_absolute_star_scale + $prm]
    }
    set buffer_absolute_star_scale $v
  }

  set v [string trim $buffer_absolute_star_scale]
  if { $v < 0.0 } {
    set v 0.0
  }
  set buffer_absolute_star_scale [format "%.2f" $v]

  if { $prm ne "/" } {
    send_ssc_lines "StelSkyDrawer.setAbsoluteStarScale($buffer_absolute_star_scale)"
  }

}

#
# 地上風景透過パラメータを stellariumサーバへ送信
#
proc send_ssc_of_landscape_transparency { args } {

  global asarr_initial_settings
  global buffer_landscape_transparency

  set prm ""
  foreach p $args {
    set prm $p
    if { $prm eq "-" || $prm eq "/" } {
      set v $asarr_initial_settings(LandscapeMgr.landscapeTransparency)
    } else {
      set v [expr $buffer_landscape_transparency + $prm]
    }
    set buffer_landscape_transparency $v
  }

  set v [string trim $buffer_landscape_transparency]
  if { $v < 0.0 } {
    set v 0.0
  } elseif { 1.0 < $v } {
    set v 1.0
  }
  set buffer_landscape_transparency [format "%.1f" $v]

  if { $prm ne "/" } {
    send_ssc_lines "LandscapeMgr.setLandscapeTransparency($buffer_landscape_transparency)"
  }

}

#
# 地上風景表示フラグを stellariumサーバへ送信
#
proc send_ssc_of_flag_landscape { flg } {

  global asarr_before_dso_zoom_settings

  # DSO zoom 実行前の設定保持をリセット
  set asarr_before_dso_zoom_settings(LandscapeMgr.flagLandscape) "-"

  send_ssc_lines "LandscapeMgr.setFlagLandscape($flg)"

}

#
# 方角切替スピードのパラメータを stellariumサーバへ送信
#
proc update_azchange_duration { args } {

  global buffer_azchange_duration

  set prm ""
  foreach p $args {
    set prm $p
    if { $prm eq "-" || $prm eq "/" } {
      set v 5
    } else {
      set v [expr $buffer_azchange_duration + $prm]
    }
    set buffer_azchange_duration $v
  }

  set v [string trim $buffer_azchange_duration]
  if { 99 < $v } {
    set v 99
  } elseif { $v < 0 } {
    set v 0
  }
  set buffer_azchange_duration [format "%d" $v]

}

#
# アプリ言語を stellariumサーバへ送信
#
proc send_ssc_of_app_language { args } {

  global asarr_initial_settings
  global buffer_cb_app_language
  global buffer_app_language
  global flag_ruby_of_labels
  global flag_dome_mode

  set prm ""
  foreach p $args {
    set prm $p
    if { $prm eq "-" || $prm eq "/" } {
      set v $asarr_initial_settings(AppLanguage)
    } else {
      set v $prm
    }
    set buffer_cb_app_language $v
  }

  set v [string trim $buffer_cb_app_language]
  set new_lang $v

  if { $v eq "KANA" } {
    set new_lang "ja_JP"
    set flag_ruby_of_labels 1
  } else {
    set flag_ruby_of_labels 0
  }
  update_gui_label_supported_ruby

  set buffer_cb_app_language $v

  if { $prm ne "/" } {
    send_ssc_lines "core.setAppLanguage('$new_lang')"
    if { $flag_dome_mode != 0 } {
      if { $buffer_app_language ne $new_lang } {
        exec_ssc_on_server updateCardinal.ssc
        #if { $flag_ruby_of_labels != 0 } {
        #  exec_ssc_on_server setCardinalWithRuby.ssc
        #}
      }
    }
  }

  set buffer_app_language $new_lang

}

#
# 観測地の緯度を stellariumサーバへ送信
#
proc send_ssc_of_location_latitude { args } {

  global asarr_initial_settings
  global buffer_location_latitude
  global buffer_location_longitude
  global buffer_location_altitude
  global buffer_location_planet
  # in date-gui.tcl
  global buffer_planet_label

  set prm ""
  foreach p $args {
    set prm $p
    if { $prm eq "-" || $prm eq "/" } {
      set v $asarr_initial_settings(Latitude)
    } else {
      set v [expr $buffer_location_latitude + $prm]
    }
    set buffer_location_latitude $v
  }

  set v [string trim $buffer_location_latitude]
  if { 90.0 < $v } {
    set v 90.0
  } elseif { $v < -90.0 } {
    set v -90.0
  }
  set buffer_location_latitude [format "%.8f" $v]

  if { $prm ne "/" } {
    send_ssc_lines "core.setObserverLocation($buffer_location_longitude,$buffer_location_latitude,$buffer_location_altitude,0.0,'Our Observatory','$buffer_location_planet')"
    # core.setTimezone("foo", 1) とすれば以下は不要
    # (localInitLocation.ssc を参照)
    #send_ssc_lines "core.setTimezone('$asarr_initial_settings(Timezone)')"
  }

}

proc send_ssc_of_location_longitude { args } {

  global asarr_initial_settings
  global buffer_location_latitude
  global buffer_location_longitude
  global buffer_location_altitude
  global buffer_location_planet
  # in date-gui.tcl
  global buffer_planet_label

  set prm ""
  foreach p $args {
    set prm $p
    if { $prm eq "-" || $prm eq "/" } {
      set v $asarr_initial_settings(Longitude)
    } else {
      set v [expr $buffer_location_longitude + $prm]
    }
    set buffer_location_longitude $v
  }

  set v [string trim $buffer_location_longitude]
  if { 180.0 < $v } {
    set v [expr -180.0 + ($v - 180.0)]
  } elseif { $v < -180.0 } {
    set v [expr 180.0 - (-180.0 - $v)]
  }
  set buffer_location_longitude [format "%.8f" $v]

  if { $prm ne "/" } {
    send_ssc_lines "core.setObserverLocation($buffer_location_longitude,$buffer_location_latitude,$buffer_location_altitude,0.0,'Our Observatory','$buffer_location_planet')"
    # core.setTimezone("foo", 1) とすれば以下は不要
    # (localInitLocation.ssc を参照)
    #send_ssc_lines "core.setTimezone('$asarr_initial_settings(Timezone)')"
  }

}

proc send_ssc_of_location_altitude { args } {

  global asarr_initial_settings
  global buffer_location_latitude
  global buffer_location_longitude
  global buffer_location_altitude
  global buffer_location_planet
  # in date-gui.tcl
  global buffer_planet_label

  set prm ""
  foreach p $args {
    set prm $p
    if { $prm eq "-" || $prm eq "/" } {
      set v $asarr_initial_settings(Altitude)
    } else {
      set v [expr $buffer_location_altitude + $prm]
    }
    set buffer_location_altitude $v
  }

  set v [string trim $buffer_location_altitude]
  if { $v < 0 } {
    set v 0
  }
  set buffer_location_altitude [format "%.0f" $v]

  if { $prm ne "/" } {
    send_ssc_lines "core.setObserverLocation($buffer_location_longitude,$buffer_location_latitude,$buffer_location_altitude,0.0,'Our Observatory','$buffer_location_planet')"
    # core.setTimezone("foo", 1) とすれば以下は不要
    # (localInitLocation.ssc を参照)
    #send_ssc_lines "core.setTimezone('$asarr_initial_settings(Timezone)')"
  }

}

proc send_ssc_of_location_planet { args } {

  global asarr_initial_settings
  global buffer_location_latitude
  global buffer_location_longitude
  global buffer_location_altitude
  global buffer_location_planet

  set prm ""
  foreach p $args {
    set prm $p
    if { $prm eq "-" || $prm eq "/" } {
      set v $asarr_initial_settings(Planet)
    } else {
      set v $prm
    }
    set buffer_location_planet $v
  }

  set v [string trim $buffer_location_planet]
  set buffer_location_planet $v

  if { $prm ne "/" } {
    send_ssc_lines "core.setObserverLocation($buffer_location_longitude,$buffer_location_latitude,$buffer_location_altitude,0.0,'Our Observatory','$buffer_location_planet')"
    # core.setTimezone("foo", 1) とすれば以下は不要
    # (localInitLocation.ssc を参照)
    #send_ssc_lines "core.setTimezone('$asarr_initial_settings(Timezone)')"
    exec_ssc_on_server setLandscape.ssc
  }

}


#
# 最小FPS値を stellariumサーバへ送信
#
proc send_ssc_of_min_fps { args } {

  global asarr_initial_settings
  global buffer_min_fps

  set prm ""
  foreach p $args {
    set prm $p
    if { $prm eq "-" || $prm eq "/" } {
      set v $asarr_initial_settings(MinFps)
    } else {
      if { 0 < $prm } {
        if { $buffer_min_fps < 2 } {
          set v [expr $buffer_min_fps + $prm]
        } else {
          set v [expr $buffer_min_fps + $prm + $prm]
        }
      } else {
        if { $buffer_min_fps < 3 } {
          set v [expr $buffer_min_fps + $prm]
        } else {
          set v [expr $buffer_min_fps + $prm + $prm]
        }
      }
    }
    set buffer_min_fps $v
  }

  set v [string trim $buffer_min_fps]
  if { $prm eq "-" || $prm eq "/" } {
    # do nothing
  } else {
    if { $v < 1.0 } {
      set v 1.0
    }
  }
  set buffer_min_fps [format "%.1f" $v]

  if { $prm ne "/" } {
    send_ssc_lines "core.setMinFps($buffer_min_fps)"
  }

  if { $buffer_min_fps < 1.0 } {
    .l_minfps configure -bg "#3000c0"
  } else {
    .l_minfps configure -bg "#000000"
  }

}

#
# グリッドラインの内部フラグ類を初期化する（グループリセット）
#
proc reset_gridlines {} {

  send_ssc_lines GridLinesMgr.setFlagGridlines(false);
  send_ssc_lines GridLinesMgr.setFlagAzimuthalGrid(false)
  send_ssc_lines GridLinesMgr.setFlagEclipticGrid(false)
  send_or_exec_ssc unsetEclipticDateLabels.ssc GridLinesMgr.setFlagEclipticLine(false)
  send_ssc_lines GridLinesMgr.setFlagEquatorGrid(false)
  send_ssc_lines GridLinesMgr.setFlagEquatorLine(false)
  exec_ssc_on_server unsetSunDiurnalMotion.ssc
  send_ssc_lines GridLinesMgr.setFlagGalacticGrid(false)
  send_ssc_lines GridLinesMgr.setFlagGalacticEquatorLine(false)

}

#
# 星雲・星団ラベルの量を stellariumサーバへ送信
#
proc send_ssc_of_dsolabels { args } {

  global buffer_dsolabels
  global asarr_initial_settings

  set prm ""
  foreach p $args {
    set prm $p
    if { $prm eq "/" } {
      set v $asarr_initial_settings(NebulaMgr.labelsAmount)
    } elseif { $prm eq "-" } {
      set v 0.0
    } else {
      set v [expr $buffer_dsolabels + $prm]
    }
    set buffer_dsolabels $v
  }

  set v [string trim $buffer_dsolabels]
  if { $v < 0.0 } {
    set v 0.0
  }
  set buffer_dsolabels [format "%.1f" $v]

  if { $prm ne "/" } {
    send_ssc_lines "NebulaMgr.setLabelsAmount($buffer_dsolabels)"
  }

}

#
# 星雲・星団ヒントの量を stellariumサーバへ送信
#
proc send_ssc_of_dsohints { args } {

  global buffer_dsohints
  global asarr_initial_settings

  set prm ""
  foreach p $args {
    set prm $p
    if { $prm eq "/" } {
      set v $asarr_initial_settings(NebulaMgr.hintsAmount)
    } elseif { $prm eq "-" } {
      set v 0.0
    } else {
      set v [expr $buffer_dsohints + $prm]
    }
    set buffer_dsohints $v
  }

  set v [string trim $buffer_dsohints]
  if { $v < 0.0 } {
    set v 0.0
  }
  set buffer_dsohints [format "%.1f" $v]

  if { $prm ne "/" } {
    send_ssc_lines "NebulaMgr.setHintsAmount($buffer_dsohints)"
  }

}

#
# filename_text を読み込み、Objects n フレームでのボタンを生成
#
#                                                        "spring" "p1"
proc build_dso_buttons { filename_text proc_name len_col sufx0    lf_sufx } {

  global font_small
  array set lines {}

  get_line_array_from_text_file $filename_text lines

  set len_lines [array size lines]

  #set len_col 3
  set i 0
  set j 0
  for {set i 0} {$i < $len_lines} {incr i} {
    if { [expr $i % $len_col] == 0 } {
      frame .fr_dso_l$j$sufx0
    }
    set lst [split $lines($i) ","]
    if { 1 < [llength $lst] } {
      set s0 [string trim [lindex $lst 0]]
      set s1 [string trim [lindex $lst 1]]
      set s1 [regsub -all { } $s1 {~}]
      create_button_small .b_dso_$i$sufx0 "$s0" "$proc_name $s1"
      pack .b_dso_$i$sufx0 -side left -expand 1 -fill x -in .fr_dso_l$j$sufx0
    } else {
      if { $lines($i) ne "-" } {
        set s0 [string trim $lines($i)]
        set s1 [regsub -all { } $s0 {~}]
        create_button_small .b_dso_$i$sufx0 "$s0" "$proc_name $s1"
        pack .b_dso_$i$sufx0 -side left -expand 1 -fill x -in .fr_dso_l$j$sufx0
      }
    }
    if { [expr ($i + 1) % $len_col] == 0 } {
      pack .fr_dso_l$j$sufx0 -expand 0 -fill x -in .lf_dso_$lf_sufx
      incr j
    }
  }
  if { [expr $i % $len_col] != 0 } {
    pack .fr_dso_l$j$sufx0 -expand 0 -fill x -in .lf_dso_$lf_sufx
  }

}

#
# 1つの天体の選択を stellariumサーバへ送信し、その天体についての
# 情報(プレインテキスト)を Object Info フレームにセット
#
proc select_a_dso { args } {

  global buffer_selected_dsoname

  foreach name $args {
    set buffer_selected_dsoname [regsub -all {~} $name { }]
  }

  set buffer_selected_dsoname [string trim $buffer_selected_dsoname]
  send_ssc_lines core.selectObjectByName('$buffer_selected_dsoname',true)

  after 500 get_object_data_from_stellarium_and_set

}

#
# 風景情報を保存し、DSO zoom を実行する
#
proc perform_dso_zoom_on_server { ssc_file } {

  global flag_dome_mode
  global asarr_before_dso_zoom_settings
  global ssc_get_current_settings

  set v $asarr_before_dso_zoom_settings(LandscapeMgr.flagLandscape)

  if { $v eq "-" } {
    # 風景情報をファイルへ書き出し
    exec_ssc_on_server $ssc_get_current_settings
    # Domeモードでは風景を消す
    if { $flag_dome_mode != 0 } {
      send_ssc_lines LandscapeMgr.setFlagLandscape(false)
      after 1000
    }
  }

  # Domeモードではマーカーを消す
  if { $flag_dome_mode != 0 } {
    send_ssc_lines core.setSelectedObjectMarkerVisible(false)
  }

  exec_ssc_on_server $ssc_file

  if { $v eq "-" } {
    after 400
    # 風景情報を配列へ保存
    get_current_settings_to asarr_before_dso_zoom_settings
  }

}

#
# DSO zoom を解除し、風景を元に戻す
#
proc reset_dso_zoom_on_server {} {

  global asarr_before_dso_zoom_settings

  send_ssc_to_initialize_view 0 1 -

  set v $asarr_before_dso_zoom_settings(LandscapeMgr.flagLandscape)
  if { $v ne "-" } {
    send_ssc_lines LandscapeMgr.setFlagLandscape($v)
    set asarr_before_dso_zoom_settings(LandscapeMgr.flagLandscape) "-"
  }

}

#
# 視野円サイズを stellariumサーバへ送信
#
proc send_ssc_of_dso_fov_circular_marker { args } {

  global buffer_dso_fov_circular_size

  set prm ""
  foreach p $args {
    set prm $p
    if { $prm eq "-" || $prm eq "/" } {
      set v 1.0
    } else {
      set v $prm
    }
    set buffer_dso_fov_circular_size $v
  }

  set v [string trim $buffer_dso_fov_circular_size]
  if { $v < 0.0 } {
    set v 0.0001
  }
  set buffer_dso_fov_circular_size [format "%.4f" $v]

  if { $prm ne "/" } {
    send_ssc_lines SpecialMarkersMgr.setFOVCircularMarkerSize($buffer_dso_fov_circular_size) SpecialMarkersMgr.setFlagFOVCircularMarker(true)
  }

}

#
# stellariumサーバ上で選択されている天体について、
# 情報(プレインテキスト)を Object Info フレームにセット
#
proc get_object_data_from_stellarium_and_set {} {

  global stellarium_status_url
  global buffer_codefield

  set ret_msg ""

  # 横線は GUI の幅マイナス1 に設定 (text .t_objinfo のオプションを参照)
  set hr_str "-------------------------------------------------------------------"
  set list_replace {"&alpha;" "α" "&delta;" "δ" "&phi;" "φ"}
  set info_str [get_object_data_from_stellarium $stellarium_status_url $hr_str $list_replace 0 ret_msg]

  if { $ret_msg eq "" } {
    # delete all in text area, and set
    .t_objinfo configure -state normal
    .t_objinfo delete 1.0 end
    .t_objinfo insert end "$info_str"
    .t_objinfo configure -state disabled
  } else {
    set buffer_codefield $ret_msg
  }

}

#
# 天体情報(プレインテキスト)をコピーバッファにセット
#
proc set_object_text_to_clipboard {} {

  set info_str [.t_objinfo get 1.0 end]

  clipboard clear
  clipboard append $info_str

}

#
# オンスクリーン時計を閉じる
#
proc kill_date_monitor {} {

  set iscserv_root [get_stellarium_io_directory]

  set pid_file "$iscserv_root/_tmp_date-monitor_pid.isc.txt"

  array set lines {}
  get_line_array_from_text_file $pid_file lines
  set len_lines [array size lines]

  if { 0 < $len_lines } {
    if { $lines(0) ne "" } {
      set pid [string trim $lines(0)]
      catch {exec taskkill /F /pid $pid 2>@1} ret
      file delete -force $pid_file
    }
  }

}

#
# オンスクリーン時計を起動
#
proc exec_date_monitor { type } {

  global TCLSRC_ENCODING
  global stellarium_status_url
  global buffer_codefield

  kill_date_monitor

  # check status of stellarium
  do_http_get $stellarium_status_url status buffer_codefield

  if { $status eq "" } {
    set buffer_codefield "ERROR in exec_date_monitor: Unable to connect to Stellarium."
  } else {
    exec wish -encoding $TCLSRC_ENCODING date-monitor.tcl $type &
  }

}


#                               #
# Configurationフレーム用のproc #
#                               #

proc send_ssc_of_projection_mode { args } {

  global asarr_initial_settings
  global buffer_projection_mode

  set prm ""
  foreach p $args {
    set prm $p
    if { $prm eq "-" || $prm eq "/" } {
      set v $asarr_initial_settings(ProjectionMode)
    } else {
      set v $prm
    }
    set buffer_projection_mode $v
  }

  set v [string trim $buffer_projection_mode]
  set buffer_projection_mode $v

  if { $prm ne "/" } {
    send_ssc_lines "core.setProjectionMode('$buffer_projection_mode')"
  }

}

proc send_ssc_of_display_gamma { args } {

  global asarr_initial_settings
  global buffer_display_gamma

  set prm ""
  foreach p $args {
    set prm $p
    set prm_idx0 [string index $prm 0]
    if { $prm eq "-" || $prm eq "/" } {
      set v $asarr_initial_settings(DisplayGamma)
    } elseif { $prm_idx0 eq "-" || $prm_idx0 eq "+" } {
      set v [expr $buffer_display_gamma + $prm]
    } else {
      set v $prm
    }
    set buffer_display_gamma $v
  }

  set v [string trim $buffer_display_gamma]
  if { $v < 0.0 } {
    set v 0.0
  }
  set buffer_display_gamma [format "%.2f" $v]

  if { $prm ne "/" } {
    send_ssc_lines "core.setDisplayGamma($buffer_display_gamma)"
  }

}

proc send_ssc_of_view_fov { args } {

  global asarr_initial_settings
  global buffer_view_fov

  set prm ""
  set duration_tm 0.0
  foreach p $args {
    set prm $p
    set prm_idx0 [string index $prm 0]
    if { $prm eq "-" || $prm eq "/" } {
      set v $asarr_initial_settings(ViewFov)
    } elseif { $prm_idx0 eq "-" || $prm_idx0 eq "+" } {
      set v [expr $buffer_view_fov + $prm]
      set duration_tm 0.0
    } else {
      # not used ...
      set v $prm
      set duration_tm 0.0
    }
    set buffer_view_fov $v
  }

  set v [string trim $buffer_view_fov]
  if { $v < 5.0 } {
    set v 5.0
  }
  set buffer_view_fov [format "%.2f" $v]

  if { $prm ne "/" } {
    send_ssc_lines "StelMovementMgr.zoomTo($buffer_view_fov,$duration_tm)"
  }

}

proc send_ssc_of_view_altitude { args } {

  global gui_tsl
  global flag_dome_mode
  global asarr_initial_settings
  global buffer_view_altitude
  global buffer_view_azimuth

  set prm ""
  set duration_tm 0.0
  foreach p $args {
    set prm $p
    set prm_idx0 [string index $prm 0]
    if { $prm eq "-" || $prm eq "/" } {
      set v $asarr_initial_settings(ViewAltitude)
      # Stellarium のバグ対策:
      #  理由はわからないが、Dome モードで NaN になる事があるので、その対策
      if { [string tolower $v] eq "nan" } {
        set ans [isc_dialog .dlg_err_alti "Info" "$gui_tsl(DIALOG_ERR_ALTI)" 1 ""  0 "OK" "" "" ""]
        # ISC Serverに保存された初期値を取得
        array set asarr_settings {}
        get_initial_settings_to asarr_settings
        set v $asarr_settings(ViewAltitude)
        if { [string tolower $v] eq "nan" } {
          set v 90.0
        }
        set prm "-"
      }
    } elseif { $prm_idx0 eq "-" || $prm_idx0 eq "+" } {
      set v [expr $buffer_view_altitude + $prm]
      set duration_tm 0.0
    } else {
      # not used ...
      set v $prm
      set duration_tm 0.0
    }
    set buffer_view_altitude $v
  }

  set v [string trim $buffer_view_altitude]
  if { $v < 0.0 } {
    set v 0.0
  }
  while { 90.0 < $v } {
    set v 90.0
  }
  set buffer_view_altitude [format "%.3f" $v]

  if { $prm ne "/" } {

    set count_retry 0
    while { 1 } {

      if { 89.99999 < $buffer_view_altitude } {
        send_ssc_lines "core.moveToAltAzi('89.99999','$buffer_view_azimuth',$duration_tm)"
      } else {
        send_ssc_lines "core.moveToAltAzi('$buffer_view_altitude','$buffer_view_azimuth',$duration_tm)"
      }

      # 引数が "-" の場合のみ NaN かどうかチェックする
      if { $prm ne "-" } {
        break
      }

      # もし値に NaN が見つかった場合、2秒おきに初期化をリトライする
      if { [test_view_prms] == 0 } {
        break
      } elseif { $count_retry < 3 } {
        after 2000
        incr count_retry
      } else {
        # Stellariumウィンドウが最小化されている場合こうなる事がある
        set ans_retry [isc_dialog .dlg_retry_alti "Question" "$gui_tsl(DIALOG_RETRY_ALTI)" 1 ""  0 "$gui_tsl(DIALOG_RETRY_ALAZ_OPT_RETRY)" "$gui_tsl(DIALOG_RETRY_ALAZ_OPT_RESTART)" "" ""]
        if { $ans_retry != 0 } {
          if { $flag_dome_mode == 0 } {
            exec tclsh exec_isc.tcl -navi &
          } else {
            exec tclsh exec_isc.tcl -dome &
          }
        }
        set count_retry 0
      }

    }

  }

}

proc send_ssc_of_view_azimuth { args } {

  global gui_tsl
  global flag_dome_mode
  global asarr_initial_settings
  global buffer_view_altitude
  global buffer_view_azimuth

  global buffer_azchange_duration

  set prm ""
  set duration_tm 0.0
  foreach p $args {
    set prm $p
    set prm_idx0 [string index $prm 0]
    if { $prm eq "-" || $prm eq "/" } {
      set v $asarr_initial_settings(ViewAzimuth)
      # Stellarium のバグ対策:
      #  理由はわからないが、Dome モードで NaN になる事があるので、その対策
      if { [string tolower $v] eq "nan" } {
        set ans [isc_dialog .dlg_err_azim "Info" "$gui_tsl(DIALOG_ERR_AZIM)" 1 ""  0 "OK" "" "" ""]
        # ISC Serverに保存された初期値を取得
        array set asarr_settings {}
        get_initial_settings_to asarr_settings
        set v $asarr_settings(ViewAzimuth)
        if { [string tolower $v] eq "nan" } {
          set v 180.0
        }
        set prm "-"
      }
    } elseif { [string range $prm 0 1] eq "++" } {
      # Domeモードでゆっくり方角を変更する場合のみ使用
      set v [expr $asarr_initial_settings(ViewAzimuth) + [string range $prm 2 end]]
      set duration_tm $buffer_azchange_duration
    } elseif { $prm_idx0 eq "-" || $prm_idx0 eq "+" } {
      set v [expr $buffer_view_azimuth + $prm]
      set duration_tm 0.0
    } else {
      set v $prm
      set duration_tm 0.0
    }
    set buffer_view_azimuth $v
  }

  set v [format "%.2f" [string trim $buffer_view_azimuth]]
  while { $v < 0.0 } {
    set v [format "%.2f" [expr $v + 360.0]]
  }
  while { 360.0 <= $v } {
    set v [format "%.2f" [expr $v - 360.0]]
  }
  set buffer_view_azimuth $v

  if { $prm ne "/" } {

    set count_retry 0
    while { 1 } {

      if { 89.99999 < $buffer_view_altitude } {
        send_ssc_lines "core.moveToAltAzi('89.99999','$buffer_view_azimuth',$duration_tm)"
      } else {
        send_ssc_lines "core.moveToAltAzi('$buffer_view_altitude','$buffer_view_azimuth',$duration_tm)"
      }

      # 引数が "-" の場合のみ NaN かどうかチェックする
      if { $prm ne "-" } {
        break
      }

      # もし値に NaN が見つかった場合、2秒おきに初期化をリトライする
      if { [test_view_prms] == 0 } {
        break
      } elseif { $count_retry < 3 } {
        after 2000
        incr count_retry
      } else {
        # Stellariumウィンドウが最小化されている場合こうなる事がある
        set ans_retry [isc_dialog .dlg_retry_azim "Question" "$gui_tsl(DIALOG_RETRY_AZIM)" 1 ""  0 "$gui_tsl(DIALOG_RETRY_ALAZ_OPT_RETRY)" "$gui_tsl(DIALOG_RETRY_ALAZ_OPT_RESTART)" "" ""]
        if { $ans_retry != 0 } {
          if { $flag_dome_mode == 0 } {
            exec tclsh exec_isc.tcl -navi &
          } else {
            exec tclsh exec_isc.tcl -dome &
          }
        }
        set count_retry 0
      }

    }

  }

}

proc send_ssc_of_viewport_x { args } {

  global asarr_initial_settings
  global buffer_viewport_x
  global buffer_viewport_y

  set prm ""
  foreach p $args {
    set prm $p
    if { $prm eq "-" || $prm eq "/" } {
      set v $asarr_initial_settings(ViewportX)
    } else {
      set v [expr $buffer_viewport_x + $prm]
    }
    set buffer_viewport_x $v
  }

  set v [string trim $buffer_viewport_x]
  set buffer_viewport_x [format "%.3f" $v]

  if { $prm ne "/" } {
    send_ssc_lines "StelMovementMgr.moveViewport($buffer_viewport_x,$buffer_viewport_y,0.0)"
  }

}

proc send_ssc_of_viewport_y { args } {

  global asarr_initial_settings
  global buffer_viewport_x
  global buffer_viewport_y

  set prm ""
  foreach p $args {
    set prm $p
    if { $prm eq "-" || $prm eq "/" } {
      set v $asarr_initial_settings(ViewportY)
    } else {
      set v [expr $buffer_viewport_y + $prm]
    }
    set buffer_viewport_y $v
  }

  set v [string trim $buffer_viewport_y]
  set buffer_viewport_y [format "%.3f" $v]

  if { $prm ne "/" } {
    send_ssc_lines "StelMovementMgr.moveViewport($buffer_viewport_x,$buffer_viewport_y,0.0)"
  }

}

proc send_ssc_of_disk_viewport { prm } {

  global asarr_initial_settings

  set v "false"
  if { $prm eq "-" || $prm eq "/" } {
    set v $asarr_initial_settings(DiskViewport)
  } else {
    set v $prm
  }

  if { $prm ne "/" } {
    send_ssc_lines "core.setDiskViewport($v)"
  }

}

proc send_ssc_of_init_view_xyfov {} {
  send_ssc_of_view_fov -
  send_ssc_of_view_azimuth -
  send_ssc_of_view_altitude -
}


#                     #
# GUI表示切替用のproc #
#                     #

proc update_gui_label_supported_ruby {} {

  global gui_tsl
  global flag_ruby_of_labels
  global textvariable_hougaku
  global textvariable_meishokobetsu
  global flag_dome_mode

  if { $flag_ruby_of_labels != 0 } {
    if { $flag_dome_mode == 0 } {
      set textvariable_hougaku "$gui_tsl(CARDINAL)"
    } else {
      set textvariable_hougaku "$gui_tsl(CARDINAL_R)"
    }
    set textvariable_meishokobetsu "$gui_tsl(INDIVIDUAL_LABEL_R)"
  } else {
    set textvariable_hougaku "$gui_tsl(CARDINAL)"
    set textvariable_meishokobetsu "$gui_tsl(INDIVIDUAL_LABEL)"
  }

}

#                    #
# タブの切替用のproc #
#                    #

proc deselect_all {} {
  global tab_background
  global tab_foreground
  .pw forget .lf_general
  .pw forget .lf_constel
  .pw forget .lf_spring
  .pw forget .lf_summer
  .pw forget .lf_autumn
  .pw forget .lf_winter
  .pw forget .lf_spring_asterism_star
  .pw forget .lf_summer_asterism_star
  .pw forget .lf_autumn_asterism_star
  .pw forget .lf_winter_asterism_star
  .pw forget .lf_summer_star
  .pw forget .lf_autumn_star
  .pw forget .lf_winter_star
  .pw forget .lf_solarsystem
  .pw forget .lf_dso_p0
  .pw forget .lf_dso_p1
  .pw forget .lf_dso_p2
  .pw forget .lf_gridlines
  .pw forget .lf_objinfo
  .pw forget .lf_config
  for {set i 0} {$i < 8} {incr i} {
    #.b_tab$i configure -bg $tab_background -fg $tab_foreground -relief raised
    configure_tab_button .b_tab$i 0
  }
}

proc select_general {} {
  global tab_selected_background
  global tab_selected_foreground
  deselect_all
  configure_tab_button .b_tab0 1
  .pw add    .lf_general
  .pw add    .lf_constel
  .pw add    .lf_solarsystem
  .pw add    .lf_gridlines
}

proc select_spring {} {
  global tab_selected_background
  global tab_selected_foreground
  deselect_all
  configure_tab_button .b_tab1 1
  .pw add    .lf_general
  .pw add    .lf_constel
  .pw add    .lf_spring
  .pw add    .lf_spring_asterism_star
}

proc select_summer {} {
  global tab_selected_background
  global tab_selected_foreground
  deselect_all
  configure_tab_button .b_tab2 1
  .pw add    .lf_general
  .pw add    .lf_constel
  .pw add    .lf_summer
  .pw add    .lf_summer_asterism_star
}

proc select_autumn {} {
  global tab_selected_background
  global tab_selected_foreground
  deselect_all
  configure_tab_button .b_tab3 1
  .pw add    .lf_general
  .pw add    .lf_constel
  .pw add    .lf_autumn
  .pw add    .lf_autumn_asterism_star
}

proc select_winter {} {
  global tab_selected_background
  global tab_selected_foreground
  deselect_all
  configure_tab_button .b_tab4 1
  .pw add    .lf_general
  .pw add    .lf_constel
  .pw add    .lf_winter
  .pw add    .lf_winter_asterism_star
}

proc select_dso {} {
  global tab_selected_background
  global tab_selected_foreground
  deselect_all
  configure_tab_button .b_tab5 1
  .pw add    .lf_general
  #.pw add    .lf_solarsystem
  .pw add    .lf_dso_p0
  #.pw add    .lf_gridlines
  .pw add    .lf_dso_p1
  .pw add    .lf_dso_p2
}

proc select_objinfo {} {
  global tab_selected_background
  global tab_selected_foreground
  deselect_all
  configure_tab_button .b_tab6 1
  .pw add    .lf_dso_p0
  .pw add    .lf_objinfo
}

proc select_config {} {
  global tab_selected_background
  global tab_selected_foreground
  deselect_all
  configure_tab_button .b_tab7 1
  .pw add    .lf_general
  .pw add    .lf_solarsystem
  .pw add    .lf_gridlines
  .pw add    .lf_config
}


####################################################################
##                                                                ##
##                          M A I N  (1)                          ##
##                                                                ##
####################################################################

# hide default wish window
wm state . withdrawn

#
# Host用 GUI かどうかのフラグ (リモートマシンの場合は 0)
#
set flag_host_gui 0

#
# 初期化, 動作モード などのフラグ
#
set flag_initialize 0
set flag_dome_mode "-"
set flag_large_gui 0
set flag_rescue 0

#
# 仮名, エディタのフラグ
#
set flag_ruby_of_labels 0
set flag_external_editor 0

set textvariable_hougaku "$gui_tsl(CARDINAL)"
set textvariable_meishokobetsu "$gui_tsl(INDIVIDUAL_LABEL)"

#
# 引数から動作モードなどを決定
#
for {set i 0} {$i < $argc} {incr i} {
  set arg [lindex $argv $i]
  if { $arg eq "-host" } {
    set flag_host_gui 1
    set flag_external_editor 1
  } elseif { $arg eq "-dome" } {
    set flag_dome_mode 1
  } elseif { [string range $arg 0 4] eq "-navi" } {
    set flag_dome_mode 0
  } elseif { [string range $arg 0 4] eq "-init" } {
    set flag_initialize 1
  } elseif { $arg eq "-rescue" } {
    set flag_rescue 1
  }
}

#
# Do not change: Set stellarium_script_dir from localConfig.ssc
#
set stellarium_script_dir [get_stellarium_isc_script_directory_name]
if { $stellarium_script_dir eq "" } {
  wm state . normal
  tk_messageBox -type ok -icon info -title "ERROR" -message "Unable to open localConfig.ssc"
  exit
}

# private proc (ダイアログ内部専用):
#  この下の接続先選択用ダイアログだけで使用
proc set_server_url { id_win url0 url1 } {

  global stellarium_url
  global iscserv_url
  global buffer_remote_hostname

  if { $url0 eq "-" } {
    exit
  } elseif { $url0 eq "/" } {
    set v [string trim $buffer_remote_hostname]
    set stellarium_url "http://$v:8090"
    set iscserv_url    "http://$v:8091"
  } else {
    set stellarium_url $url0
    set iscserv_url    $url1
  }

  destroy $id_win

}

#
# list_host.txt を読み取り、接続先選択用ダイアログを出す
#
if { $flag_host_gui == 0 } {

  set stellarium_url ""
  set iscserv_url    ""

  # リモート用GUIはデフォルトでは Large GUI とする
  set flag_large_gui 1

  array set lines {}
  #array set host0_url {}
  #array set host1_url {}
  #array set description {}

  get_line_array_from_text_file "list_host.txt" lines

  set len_lines [array size lines]

  # Toplevel Window ID
  set top ".dlg_remote"

  toplevel $top
  wm title $top "Interstellar Console --- remote control"
  wm resizable $top 0 0

  frame $top.fr_select_host_relief -relief raised -bd [scaled_thick_border 2]

  frame $top.fr_select_host_splash

  image create photo splashim -file [get_splash_filename]
  label $top.l_splash -image splashim -borderwidth 0
  pack $top.l_splash -in $top.fr_select_host_splash

  frame $top.fr_select_host_body

  frame $top.fr_select_host_0

  # 「接続先を選んでください」
  label $top.l_select_host -text "$gui_tsl(DIALOG_SELECT_HOST)"
  pack $top.l_select_host -side left -expand 1 -fill x -in $top.fr_select_host_0

  create_button $top.b_select_host_ed "$gui_tsl(EDIT)" "open_text_editor .edt_host list_host.txt"
  pack $top.b_select_host_ed -expand 0 -fill y -in $top.fr_select_host_0

  pack $top.fr_select_host_0 -expand 1 -fill x -padx [scaled_px 2] -pady [scaled_px 2] -in $top.fr_select_host_body

  set j 0
  for {set i 0} {$i < $len_lines} {incr i} {
    set lst [split $lines($i) ","]
    set len_lst [llength $lst]
    if { 0 < $len_lst } {
      set hostname [string trim [lindex $lst 0]]
      set port0 "8090"
      set port1 "8091"
      set desc ""
      if { 1 < $len_lst } {
        set s [string trim [lindex $lst 1]]
        if { $s ne "" } {
          set port0 $s
        }
      }
      if { 2 < $len_lst } {
        set s [string trim [lindex $lst 2]]
        if { $s ne "" } {
          set port1 $s
        }
      }
      if { 3 < $len_lst } {
        set s [string trim [lindex $lst 3]]
        set desc $s
      }
      set host0_url "http://$hostname:$port0"
      set host1_url "http://$hostname:$port1"
      #
      create_button $top.b_select_host_$j "$hostname --- $desc" "set_server_url $top $host0_url $host1_url"
      pack $top.b_select_host_$j -fill x -padx [scaled_px 2] -pady [scaled_px 2] -in $top.fr_select_host_body
      incr j
    }
  }
  set n_hosts $j

  set buffer_remote_hostname "192.168."

  frame $top.fr_input_host
  label $top.l_input_host_0 -text "To http://"
  #entry $top.e_input_host -width 15 -textvariable buffer_remote_hostname
  ttk::entry $top.e_input_host -width 15 -textvariable buffer_remote_hostname
  bind $top.e_input_host <Return> "set_server_url $top / /"
  label $top.l_input_host_1 -text ":8090,8091"
  create_button $top.l_input_host "$gui_tsl(CONNECT)" "set_server_url $top / /"
  pack $top.l_input_host_0 -side left -in $top.fr_input_host
  pack $top.e_input_host -side left -fill x -expand 1 -in $top.fr_input_host
  pack $top.l_input_host_1 $top.l_input_host -side left -in $top.fr_input_host

  pack $top.fr_input_host -fill x -expand 1 -padx [scaled_px 2] -pady [scaled_px 2] -in $top.fr_select_host_body

  frame $top.fr_cb_large_gui
  ttk::checkbutton $top.cb_large_gui -text "$gui_tsl(DIALOG_OPT_USE_LARGE_GUI)" -variable flag_large_gui
  pack $top.cb_large_gui -in $top.fr_cb_large_gui

  pack $top.fr_cb_large_gui -side left -fill x -expand 1 -padx [scaled_px 2] -pady [scaled_px 2] -in $top.fr_select_host_body

  create_button $top.b_select_host_$j "$gui_tsl(CANCEL)" "set_server_url $top - -"
  pack $top.b_select_host_$j -padx [scaled_px 2] -pady [scaled_px 2] -in $top.fr_select_host_body

  if { $n_hosts < 5 } {
    pack $top.fr_select_host_splash -padx [scaled_px 5] -pady [scaled_px 5] -in $top.fr_select_host_relief
  } else {
    pack $top.fr_select_host_splash -side left -padx [scaled_px 5] -pady [scaled_px 5] -in $top.fr_select_host_relief
  }

  pack $top.fr_select_host_body -expand 0 -padx [scaled_px 8] -pady [scaled_px 8] -in $top.fr_select_host_relief

  pack $top.fr_select_host_relief

  wm withdraw $top
  update

  set pos_x [ expr {( [winfo screenwidth .] - [winfo width $top] ) / 2 } ]
  set pos_y [ expr {( [winfo screenheight .] - [winfo height $top] ) / 2 } ]

  wm geometry $top +$pos_x+$pos_y
  wm transient $top .
  wm deiconify $top
  wm state $top normal

  raise $top
  #wm attributes $top -topmost yes

  $top.e_input_host icursor end
  focus $top.e_input_host

  # 他のウィンドゥの操作を禁止
  #grab set $top
  # $top が destroy されるまで待つ
  tkwait window $top

}

if { $stellarium_url eq "" } {
  exit
}


#
# サーバURL (1)  サーバ側に保存されているスクリプト(staticなコード)
#                を実行する時に利用
# 
set stellarium_run_url "$stellarium_url/api/scripts/run"

#
# サーバURL (2)  クライアントで生成したスクリプト(dynamicなコード)
#                を送信する時に利用
# 
#  【注意】direct を使う場合、実行できるのは１行のみらしい。
#          複数行のコードを送信すると、Stellariumがクラッシュする
set stellarium_direct_url "$stellarium_url/api/scripts/direct"

#
# サーバURL (3)  情報取得用
# 
set stellarium_status_url "$stellarium_url/api/main/status"

#
# Stellarium との通信を確認
#
do_http_get $stellarium_status_url status buffer_codefield
if { $status eq "" } {
  isc_dialog .dlg_stl_no_connection "ERROR" "$gui_tsl(DIALOG_STEL_NO_CONNECTION)" 0 ""  0 " OK " "" "" ""
  exit
}

# この後 初期化される場合は待機状態にする
if { $flag_initialize != 0 } {
  send_ssc_lines core.setMinFps(4.0)
}

#
# 動作モードの決定
#

proc set_selection { id_win v0 v1 } {
  global flag_dome_mode
  global flag_large_gui
  if { $v0 ne "-" } {
    set flag_dome_mode $v0
  }
  if { $v1 ne "-" } {
    set flag_large_gui $v1
  }
  destroy $id_win
}

if { $flag_host_gui != 0 } {

  #
  # Host用 GUI (動作モード、GUIサイズを選択)
  #

  #
  # ステータス取得用 sscファイル, txtファイル
  #
  set ssc_get_current_settings "getCurrentSettings_0.ssc"
  set txt_current_settings_isc "_tmp_currentSettings_0.isc.txt"

  #
  # 動作モード/GUIサイズ 選択 ダイアログ
  #

  # Toplevel Window ID
  set top ".dlg_selmode"

  while { 1 } {

    toplevel $top
    wm title $top "Interstellar Console --- Selection"
    wm resizable $top 0 0
    wm attributes $top -topmost yes

    frame $top.fr_select_gui_dlg_relief -relief raised -bd [scaled_thick_border 2]

    frame $top.fr_select_gui_dlg

    if { $flag_dome_mode eq "-" } {

      if { [get_flag_dome_mode_on_server] != 0 } {
        set flag_large_gui 1
      } else {
        set flag_large_gui 0
      }

      # 「動作モードを選択してください」
      label $top.l_select_gui_dlg -text "$gui_tsl(DIALOG_SELECT_OPERATING_MODE)"

      frame $top.fr_select_gui_dlg_0

      create_button $top.b_select_gui_dlg_0 "Navigation" "set_selection $top 0 -"
      create_button $top.b_select_gui_dlg_1 "   Dome   " "set_selection $top 1 -"
      pack $top.b_select_gui_dlg_0 $top.b_select_gui_dlg_1 -side left -expand 1 -padx [scaled_px 2] -in $top.fr_select_gui_dlg_0
      if { $flag_rescue != 0 } {
        create_button $top.b_select_gui_dlg_2 "$gui_tsl(DIALOG_OPT_EXIT_ALL)" "exec tclsh exec_isc.tcl -kill &"
        pack $top.b_select_gui_dlg_2 -side left -expand 1 -padx [scaled_px 2] -in $top.fr_select_gui_dlg_0
      }

      frame $top.fr_cb_large_gui
      ttk::checkbutton $top.cb_large_gui -text "$gui_tsl(DIALOG_OPT_USE_LARGE_GUI)" -variable flag_large_gui
      pack $top.cb_large_gui -in $top.fr_cb_large_gui

      pack $top.l_select_gui_dlg -fill x -expand 1 -padx [scaled_px 2] -pady [scaled_px 10] -in $top.fr_select_gui_dlg
      pack $top.fr_select_gui_dlg_0 $top.fr_cb_large_gui -fill x -expand 1 -padx [scaled_px 2] -pady [scaled_px 4] -in $top.fr_select_gui_dlg

      bind $top.b_select_gui_dlg_0 <Return> {%W invoke}
      bind $top.b_select_gui_dlg_1 <Return> {%W invoke}

      pack $top.fr_select_gui_dlg -padx [scaled_px 8] -pady [scaled_px 4] -in $top.fr_select_gui_dlg_relief

      pack $top.fr_select_gui_dlg_relief

      wm withdraw $top
      update

      set pos_x [ expr {( [winfo screenwidth .] - [winfo width $top] ) / 2 } ]
      set pos_y [ expr {( [winfo screenheight .] - [winfo height $top] ) / 2 } ]

      wm geometry $top +$pos_x+$pos_y
      wm transient $top .
      wm deiconify $top
      wm state $top normal

      raise $top

      if { $flag_large_gui == 0 } {
        focus $top.b_select_gui_dlg_0
      } else {
        focus $top.b_select_gui_dlg_1
      }

    } else {

      # 「GUIサイズを選択してください」
      label $top.l_select_gui_dlg -text "$gui_tsl(DIALOG_SELECT_GUI_SIZE)"
      pack $top.l_select_gui_dlg -expand 0 -padx [scaled_px 2] -pady [scaled_px 8] -in $top.fr_select_gui_dlg

      create_button $top.b_select_gui_dlg_0 "Normal" "set_selection $top - 0"
      create_button $top.b_select_gui_dlg_1 "Large"  "set_selection $top - 1"
      pack $top.b_select_gui_dlg_0 $top.b_select_gui_dlg_1 -side left -expand 1 -padx [scaled_px 2] -pady [scaled_px 8] -in $top.fr_select_gui_dlg

      bind $top.b_select_gui_dlg_0 <Return> {%W invoke}
      bind $top.b_select_gui_dlg_1 <Return> {%W invoke}

      pack $top.fr_select_gui_dlg -padx [scaled_px 8] -pady [scaled_px 4] -in $top.fr_select_gui_dlg_relief

      pack $top.fr_select_gui_dlg_relief

      wm withdraw $top
      update

      set pos_x [ expr {( [winfo screenwidth .] - [winfo width $top] ) / 2 } ]
      set pos_y [ expr {( [winfo screenheight .] - [winfo height $top] ) / 2 } ]

      wm geometry $top +$pos_x+$pos_y
      wm transient $top .
      wm deiconify $top
      wm state $top normal

      raise $top

      if { $flag_dome_mode == 0 } {
        focus $top.b_select_gui_dlg_0
      } else {
        focus $top.b_select_gui_dlg_1
      }

    }

    # 他のウィンドゥの操作を禁止
    grab set $top
    # $top が destroy されるまで待つ
    tkwait window $top

    if { $flag_dome_mode ne "-" } {
      break
    }

  }

} else {

  #
  # Remote用 設定
  #

  # ISC Server から remote ID (1から9) を取得する
  do_http_get $iscserv_url/new_remote_id ret buffer_codefield
  set remote_id [string trim $ret]
  if { $remote_id eq "" } {
    isc_dialog .dlg_exceed_n_remote "ERROR" "$gui_tsl(DIALOG_EXCEED_N_REMOTE)" 0 ""  0 " OK " "" "" ""
    exit
  }

  #
  # ステータス取得用 sscファイル, txtファイル
  #
  set ssc_get_current_settings "getCurrentSettings_$remote_id.ssc"
  set txt_current_settings_isc "_tmp_currentSettings_$remote_id.isc.txt"

  # ホストの動作モードと同じにする

  if { [get_flag_dome_mode_on_server] != 0 } {
    set flag_dome_mode 1
  } else {
    set flag_dome_mode 0
  }

}


####################################################################
##                                                                ##
##                          S P L A S H                           ##
##                                                                ##
####################################################################

#
# Ver.1.4 から isc_dialog で表示するようになり、未使用
#
# Splash はホストで初期化する時のみ表示。
# (別プロセスでないとうまく動かないので exec wish できない OS では表示しない)
#
#if { $flag_available_exec != 0 && $flag_host_gui != 0 && $flag_initialize != 0 } {
#  # Stellarium の初期化に最低でも4秒はかかる
#  set ret [exec -ignorestderr wish splash.tcl 5000 [get_splash_filename] &]
#}


####################################################################
##                                                                ##
##                    G U I   S E T T I N G S                     ##
##                                                                ##
####################################################################

#
# 色・フォントの設定
#

set label_new_block_background "#501010"
set label_new_block_foreground "#ff7070"
set label_inverted_background "#d05050"
set label_inverted_foreground "#000000"

set tab_background "#383838"
set tab_foreground "#ff6060"
set tab_selected_background "#d08000"
set tab_selected_foreground "#000000"

set reload_button_background "#203060"
set reset_button_foreground "#ff6060"
set reset_button_background "#383838"
set exit_button_foreground "#ff9090"
set exit_button_background "#701010"

if { $flag_large_gui == 0 } {
  # Normal GUI モード
  # デフォルト
  option add *font [list $gui_font_name $fsz_table(SZ12)]
  set font_small [list $gui_font_name $fsz_table(SZ10)]
  set font_filename [list $gui_font_name $fsz_table(SZ10)]
  # ラベルフレーム
  set font_labelframe [list $gui_font_name $fsz_table(SZ10)]
  # コードフィールド
  set font_codefield [list $gui_font_name $fsz_table(SZ10)]
  # 内部情報
  set font_internal [list $gui_font_name $fsz_table(SZ10)]
  # マージン・パッド
  # Constellation,SolarSystem,GridLines上部のリセットボタン下のパッド
  set pad_bottom_for_group_reset_button [scaled_px 6]
  set margin_for_high_density_gui [scaled_px 2]
  set margin_before_new_block [scaled_px 5]
  set margin_before_new_dso_block [scaled_px 3]
  # ノーマルなbuttonと全く同じサイズにする
  ttk::style configure TButton -font [list $gui_font_name $fsz_table(SZ12)]
  ttk::style configure TButton -padding [scaled_padding 3 3]
  ttk::style configure Exit.TButton -background $exit_button_background -foreground $exit_button_foreground
  ttk::style configure Allreset.TButton -background $reset_button_background -foreground $reset_button_foreground
  ttk::style configure Small.TButton -font [list $gui_font_name $fsz_table(SZ10)]
  ttk::style configure Small.TButton -padding [scaled_padding 2 1]
  ttk::style configure Reload.TButton -font [list $gui_font_name $fsz_table(SZ10)]
  ttk::style configure Reload.TButton -padding [scaled_padding 2 1] -background $reload_button_background
  ttk::style configure Code.TButton -font [list $gui_font_name $fsz_table(SZ10)]
  ttk::style configure Code.TButton -padding [scaled_padding 2 1]
  # タブのボタンは縦幅を小さく。MacOSでは縦幅が標準の50%になるため、ここは最低でも半分にする必要がある
  ttk::style configure Exit.TButton        -padding [scaled_padding 3 1]
  ttk::style configure Tab.TButton         -padding [scaled_padding 3 1]
  ttk::style configure SelectedTab.TButton -padding [scaled_padding 3 1]
  #
  ttk::style configure TEntry -font [list $gui_font_name $fsz_table(SZ12)]
  #
  ttk::style configure TCheckbutton -font [list $gui_font_name $fsz_table(SZ12)] -padding [scaled_padding 8 8]
  ttk::style configure TCheckbutton -indicatordiameter [scaled_px 10]
  ttk::style configure Small.TCheckbutton -font [list $gui_font_name $fsz_table(SZ10)]
  ttk::style configure TCombobox -arrowsize [scaled_px 10]
} else {
  # Large GUI モード
  if { [info exists large_gui_font_name] } {
    set gui_font_name $large_gui_font_name
  }
  if { [info exists large_button_border] } {
    option add *Button.borderWidth [scaled_thick_border $large_button_border]
    ttk::style configure TButton -borderwidth [scaled_thick_border $large_button_border] -width 0
  }
  if { [info exists large_label_border] } {
    option add *Label.borderWidth [scaled_px $large_label_border]
  }
  # デフォルト
  option add *font [list $gui_font_name $fsz_table(SZ20)]
  set font_small [list $gui_font_name $fsz_table(SZ16)]
  set font_filename [list $gui_font_name $fsz_table(SZ14)]
  # ラベルフレーム
  set font_labelframe [list $gui_font_name $fsz_table(SZ12)]
  # コードフィールド
  set font_codefield [list $gui_font_name $fsz_table(SZ14)]
  # 内部情報
  set font_internal [list $gui_font_name $fsz_table(SZ10)]
  # マージン・パッド
  # Constellation,SolarSystem,GridLines上部のリセットボタン下のパッド
  set pad_bottom_for_group_reset_button [scaled_px 10]
  set margin_for_high_density_gui [scaled_px 2]
  set margin_before_new_block [scaled_px 10]
  set margin_before_new_dso_block [scaled_px 5]
  # ノーマルなbuttonと全く同じサイズにする
  ttk::style configure TButton -font [list $gui_font_name $fsz_table(SZ20)]
  ttk::style configure TButton -padding [scaled_padding 12 11]
  ttk::style configure Exit.TButton -background $exit_button_background -foreground $exit_button_foreground
  ttk::style configure Allreset.TButton -background $reset_button_background -foreground $reset_button_foreground
  ttk::style configure Small.TButton -font [list $gui_font_name $fsz_table(SZ16)]
  ttk::style configure Small.TButton -padding [scaled_padding 8 7]
  ttk::style configure Reload.TButton -font [list $gui_font_name $fsz_table(SZ16)]
  ttk::style configure Reload.TButton -padding [scaled_padding 8 7] -background $reload_button_background
  ttk::style configure Code.TButton -font [list $gui_font_name $fsz_table(SZ14)]
  ttk::style configure Code.TButton -padding [scaled_padding 6 5]
  # タブのボタンは縦幅を小さく。MacOSでは縦幅が標準の50%になるため、ここは最低でも半分にする必要がある
  ttk::style configure Exit.TButton        -padding [scaled_padding 10 5]
  ttk::style configure Tab.TButton         -padding [scaled_padding 10 5]
  ttk::style configure SelectedTab.TButton -padding [scaled_padding 10 5]
  #
  ttk::style configure TEntry -font [list $gui_font_name $fsz_table(SZ20)]
  #
  ttk::style configure TCheckbutton -font [list $gui_font_name $fsz_table(SZ20)] -padding [scaled_padding 10 10]
  ttk::style configure TCheckbutton -indicatordiameter [scaled_px 16]
  ttk::style configure Small.TCheckbutton -font [list $gui_font_name $fsz_table(SZ16)]
  ttk::style configure TCombobox -arrowsize [scaled_px 16]
}

ttk::style configure SelectedTab.TButton -foreground $tab_selected_foreground -background $tab_selected_background -focuscolor "#9a3030" -relief sunken
ttk::style map SelectedTab.TButton -background [list active $tab_selected_background]

option add *TCombobox*Listbox.font $font_small

# マウスオーバー時の背景色
ttk::style map Exit.TButton -background [list active $exit_button_background]
ttk::style map Allreset.TButton -background [list active $reset_button_background]
ttk::style map Reload.TButton -background [list active $reload_button_background]


# ウィンドゥ名称,属性の設定
set title_str "Interstellar Console :: main"
set os_name [get_os_name]
set major_ver [get_stellarium_major_version]
if { $flag_dome_mode == 0 } {
  append title_str " (Navi, backend=v$major_ver, $os_name, $windows_scaling_pct%)"
} else {
  append title_str " (Dome, backend=v$major_ver, $os_name, $windows_scaling_pct%)"
}
if { $flag_host_gui != 0 } {
  append title_str " (Host)"
} else {
  append title_str " ($stellarium_url)"
}
wm title . $title_str
wm resizable . 0 0
if { $flag_host_gui != 0 } {
  # ホストの場合 Xボタンは強制終了ボタンとする
  wm protocol . WM_DELETE_WINDOW [list urgent_exit_or_reboot]
}

# 初期設定での光害ON/OFF
set flag_light_pollution_after_initialization 1

# 方角変更にかかる秒数の初期値
set buffer_azchange_duration 5

# DSO名の初期値
set buffer_selected_dsoname "M42"

# 最後にGUIで設定された日付時刻。入力フィールドの[DATE]ボタンで呼び出せる
set buffer_datearg [clock format [clock seconds] -format {%Y-%m-%dT%H:%M:%S}]

# 星ラベル用連想配列
array set asarr_star_label {}

# 星、天の川の明るさ等 初期値保存用 連想配列
array set asarr_initial_settings {
  FlagDomeMode false
  AppLanguage en_US
  FlagSaveAppLanguage false
  StelSkyDrawer.relativeStarScale 1.0
  StelSkyDrawer.absoluteStarScale 1.0
  MilkyWay.intensity 1.0
  ZodiacalLight.intensity 1.0
  LandscapeMgr.landscapeTransparency 0.0
  LandscapeMgr.flagLandscape true
  SkyCulture japanese_misato-art
  Altitude 0
  Longitude 135.18989563
  Latitude 34.19189835
  Timezone Asia/Tokyo
  Planet Earth
  ProjectionMode ProjectionStereographic
  DisplayGamma 2.2
  ViewFov 190.0
  ViewAltitude 90.0
  ViewAzimuth 180.0
  ViewportX 0.0
  ViewportY 0.0
  DiskViewport false
  TimeRate 0
  MinFps 18.0
  StarMgr.labelsAmount 0
  SolarSystem.labelsAmount 0
  SolarSystem.planetScale 1
  SolarSystem.moonScale 4
  SolarSystem.sunScale 4
  NebulaMgr.hintsAmount 0
  NebulaMgr.labelsAmount 0
  SporadicMeteorMgr.ZHR 0
}

# DSO zoom 実行前の設定を保存
array set asarr_before_dso_zoom_settings {
  LandscapeMgr.flagLandscape -
}


####################################################################
##                                                                ##
##                G U I   C O N S T R U C T I O N                 ##
##                                                                ##
####################################################################

########################################################################

frame .fr_rootwin

########################################################################

frame .fr_guitab

labelframe .lf_gui -text "GUI" -font $font_labelframe

# 終了ボタンは Host用 GUI のみ
if { $flag_host_gui != 0 } {
  #button .b_exitall -text "終" -background $exit_button_background -command "exit_or_reboot"
  #create_button .b_exitall "終" "exit_or_reboot"
  ttk::button .b_exitall -style Exit.TButton -text $gui_tsl(EXIT) -command "exit_or_reboot"
  pack .b_exitall -side left -expand 0 -fill y -in .lf_gui
}

if { $flag_host_gui != 0 } {
  #button .b_dategui -text "日時" -font $font_small -command "open_date_gui .date_gui"
  #create_button_small .b_dategui "日時" "open_date_gui .date_gui"
  ttk::button .b_dategui -style Small.TButton -text $gui_tsl(DATE) -command "open_date_gui .date_gui"
} else {
  #button .b_dategui -text "日時" -command "open_date_gui .date_gui"
  #create_button .b_dategui "日時" "open_date_gui .date_gui"
  ttk::button .b_dategui -text $gui_tsl(DATE) -command "open_date_gui .date_gui"
}

#button .b_mediagui -text "Media" -font $font_small -command "open_media_gui .media_gui 0"
#button .b_reload -text "Reload" -background $reload_button_background -font $font_small -command "reload_all_gui_params"
#create_button_small .b_mediagui "Media"  "open_media_gui .media_gui 0"
ttk::button .b_mediagui -style Small.TButton -text $gui_tsl(MEDIA) -command "open_media_gui .media_gui 0"
#create_button_small .b_reload   "Reload" "reload_all_gui_params"
ttk::button .b_reload -style Reload.TButton -text $gui_tsl(RELOAD) -command "reload_all_gui_params"
pack .b_dategui .b_mediagui .b_reload -side left -expand 0 -fill y -in .lf_gui

labelframe .lf_selection -text "Selection" -font $font_labelframe

#button .b_tab0 -text "一般" -command "select_general"
#button .b_tab1 -text "星座 春" -command "select_spring"
#button .b_tab2 -text "星座 夏" -command "select_summer"
#button .b_tab3 -text "星座 秋" -command "select_autumn"
#button .b_tab4 -text "星座 冬" -command "select_winter"
#button .b_tab5 -text "天体" -command "select_dso"
#button .b_tab6 -text "情報" -font $font_small -command "select_objinfo"
#button .b_tab7 -text "設定" -font $font_small -command "select_config"
#create_button .b_tab0 "一般" "select_general"
#create_button .b_tab1 "星座 春" "select_spring"
#create_button .b_tab2 "星座 夏" "select_summer"
#create_button .b_tab3 "星座 秋" "select_autumn"
#create_button .b_tab4 "星座 冬" "select_winter"
#create_button .b_tab5 "天体" "select_dso"
#create_button .b_tab6 "情報" "select_objinfo"
#create_button .b_tab7 "設定" "select_config"
ttk::button .b_tab0 -style Tab.TButton -text $gui_tsl(GENERAL) -command "select_general"
ttk::button .b_tab1 -style Tab.TButton -text $gui_tsl(CONSTEL_SPRING) -command "select_spring"
ttk::button .b_tab2 -style Tab.TButton -text $gui_tsl(CONSTEL_SUMMER) -command "select_summer"
ttk::button .b_tab3 -style Tab.TButton -text $gui_tsl(CONSTEL_AUTUMN) -command "select_autumn"
ttk::button .b_tab4 -style Tab.TButton -text $gui_tsl(CONSTEL_WINTER) -command "select_winter"
ttk::button .b_tab5 -style Tab.TButton -text $gui_tsl(OBJECTS) -command "select_dso"
ttk::button .b_tab6 -style Tab.TButton -text $gui_tsl(INFO) -command "select_objinfo"
ttk::button .b_tab7 -style Tab.TButton -text $gui_tsl(CONFIG) -command "select_config"

pack .b_tab0 .b_tab1 .b_tab2 .b_tab3 .b_tab4 .b_tab5 -side left -expand 1 -fill x -in .lf_selection
pack .b_tab6 .b_tab7 -side left -expand 0 -fill y -in .lf_selection

pack .lf_gui -side left -expand 0 -padx [scaled_px 3] -pady [scaled_px 2] -in .fr_guitab
pack .lf_selection -side left -expand 1 -fill x  -padx [scaled_px 3] -pady [scaled_px 2] -in .fr_guitab

pack .fr_guitab -expand 0 -fill x -padx [scaled_px 1] -pady [scaled_px 1] -in .fr_rootwin


################################################################

panedwindow .pw
pack .pw -fill x -padx [scaled_px 3] -pady [scaled_px 2] -in .fr_rootwin

################################################################

labelframe .lf_general -text "General" -font $font_labelframe

frame .fr_init
label .l_init -text "$gui_tsl(INITIALIZE)"
# Note: Light Pollution settings are disabled by localInitLocation.ssc.
#ttk::button .b_init0 -style Allreset.TButton -text "全" -command "send_ssc_to_initialize_all 2"
create_button .b_init0 "$gui_tsl(INIT_ALL)" "send_ssc_to_initialize_all 2"
create_button .b_init1 "$gui_tsl(INIT_VIEW)" "send_ssc_to_initialize_view 1 0 -"
create_button .b_init2 "$gui_tsl(INIT_LOCATION)" "send_ssc_to_initialize_location"
create_button .b_init3 "$gui_tsl(INIT_20H)" "send_ssc_from_timearg 20:00:00"
pack .l_init -in .fr_init
pack .b_init0 .b_init1 .b_init2 .b_init3 -side left -expand 1 -fill x -in .fr_init

frame .fr_tmrate
frame .fr_tmrate_l
label .l_tmrate -text "$gui_tsl(TIME_RATE)" -padx 0
label .l_tmrate_b -text "$gui_tsl(TIME_RATE_S)" -font $font_small -padx 0
pack .l_tmrate -side left -padx 0 -in .fr_tmrate_l
if { $gui_tsl(TIME_RATE_S) ne "" } {
  pack .l_tmrate_b -side left -padx 0 -in .fr_tmrate_l
}
create_button .b_tmrate0 "$gui_tsl(TR_ZERO)" "send_ssc_of_timerate 0.0"
create_button .b_tmrate1 "$gui_tsl(TR_REAL)" "send_ssc_of_timerate 1.0"
#entry .e_tmrate -width 5 -textvariable buffer_timerate
ttk::entry .e_tmrate -width 5 -textvariable buffer_timerate
set buffer_timerate "0.0"
create_button .b_tmrate2 "$gui_tsl(ARR_LEFT)" "send_ssc_of_timerate -20.0"
create_button .b_tmrate3 "$gui_tsl(ARR_RIGHT)" "send_ssc_of_timerate +20.0"
bind .e_tmrate <Return> "send_ssc_of_timerate"
pack .fr_tmrate_l -in .fr_tmrate
pack .b_tmrate0 -side left -expand 1 -fill both -in .fr_tmrate
pack .b_tmrate1 -side left -fill both -in .fr_tmrate
pack .e_tmrate -side left -expand 1 -fill both -in .fr_tmrate
pack .b_tmrate2 .b_tmrate3 -side left -fill both -in .fr_tmrate

frame .fr_illumi
label .l_illumi -text "$gui_tsl(LIGHT_POLLUTION)"
create_button .b_illumi2 "ON" "exec_ssc_on_server setLightPollution.ssc setLandscape.ssc"
create_button .b_illumi1 "Off" "exec_ssc_on_server unsetLightPollution.ssc setLandscape.ssc"
create_button .b_illumi0 "$gui_tsl(LIGHT_POL_SOL_OFF)" "unset_solarsystem -"
pack .l_illumi -in .fr_illumi
pack .b_illumi0 .b_illumi1 .b_illumi2 -side left -expand 1 -fill x -in .fr_illumi

frame .fr_atmos
label .l_atmos -text "$gui_tsl(ATMOSPHERE)" -font $font_small
create_button_small .b_atmos2 "$gui_tsl(ATMOSPHERE_FOG)" "send_ssc_lines LandscapeMgr.setFlagAtmosphere(true) LandscapeMgr.setFlagFog(true)"
create_button_small .b_atmos1 "ON" "send_ssc_lines LandscapeMgr.setFlagFog(false) LandscapeMgr.setFlagAtmosphere(true)"
create_button_small .b_atmos0 "Off" "send_ssc_lines LandscapeMgr.setFlagFog(false) LandscapeMgr.setFlagAtmosphere(false)"
pack .l_atmos -in .fr_atmos
pack .b_atmos0 .b_atmos1 .b_atmos2 -side left -expand 1 -fill x -in .fr_atmos

set buffer_milkyway $asarr_initial_settings(MilkyWay.intensity)
frame .fr_milky
label .l_milky -text "$gui_tsl(MILKYWAY_INTENSITY)" -font $font_small
create_button_small .b_milky0 "$gui_tsl(INIT)" "send_ssc_of_milkyway -"
#entry .e_milky -font $font_small -width 5 -textvariable buffer_milkyway
ttk::entry .e_milky -font $font_small -width 5 -textvariable buffer_milkyway
create_button_small .b_milky1 "$gui_tsl(ARR_LEFT)" "send_ssc_of_milkyway -0.1"
create_button_small .b_milky2 "$gui_tsl(ARR_RIGHT)" "send_ssc_of_milkyway +0.1"
bind .e_milky <Return> "send_ssc_of_milkyway"
pack .l_milky -in .fr_milky
pack .b_milky0 -side left -fill both -in .fr_milky
pack .e_milky -expand 1 -side left -fill both -in .fr_milky
pack .b_milky1 .b_milky2 -side left -fill both -in .fr_milky

#
# "星表現:絶対" "星表現:相対"
# 横並び、縦並びを指定
#
set flag_virtical_gui_of_star_scale 0
if { $flag_dome_mode == 0 } {
  set flag_virtical_gui_of_star_scale 1
}

frame .fr_gen_lbl01

# モードでボタンのラベルを変える
if { $flag_virtical_gui_of_star_scale != 0 } {
  set txt_abs "$gui_tsl(SS_ABS)"
  set txt_rel "$gui_tsl(SS_REL)"
  set txt_init "$gui_tsl(INIT)"
  set txt_arw_l "$gui_tsl(ARR_LEFT)"
  set txt_arw_r "$gui_tsl(ARR_RIGHT)"
} else {
  set txt_abs "$gui_tsl(STAR_SCALE_ABS)"
  set txt_rel "$gui_tsl(STAR_SCALE_REL)"
  set txt_init "$gui_tsl(INIT_S)"
  set txt_arw_l "$gui_tsl(ARR_S_LEFT)"
  set txt_arw_r "$gui_tsl(ARR_S_RIGHT)"
}

label .l_gen_label001002 -text "$gui_tsl(STAR_SCALE)" -font $font_small

set buffer_absolute_star_scale $asarr_initial_settings(StelSkyDrawer.absoluteStarScale)
frame .fr_gen_label001
label .l_gen_label001 -text $txt_abs -font $font_small
create_button_small .b_absstar0 $txt_init "send_ssc_of_absolute_star_scale -"
#entry .e_absstar -font $font_small -width 4 -textvariable buffer_absolute_star_scale
ttk::entry .e_absstar -font $font_small -width 4 -textvariable buffer_absolute_star_scale
create_button_small .b_absstar1 $txt_arw_l "send_ssc_of_absolute_star_scale -0.05"
create_button_small .b_absstar2 $txt_arw_r "send_ssc_of_absolute_star_scale +0.05"
bind .e_absstar <Return> "send_ssc_of_absolute_star_scale"
if { $flag_virtical_gui_of_star_scale != 0 } {
  pack .l_gen_label001 -expand 1 -side left -in .fr_gen_label001
} else {
  pack .l_gen_label001 -in .fr_gen_label001
}
pack .b_absstar0 -side left -fill both -in .fr_gen_label001
pack .e_absstar -side left -expand 1 -fill both -in .fr_gen_label001
pack .b_absstar1 .b_absstar2 -side left -fill both -in .fr_gen_label001

if { $flag_virtical_gui_of_star_scale == 0 } {
  frame .fr_star_scale_margin -width $margin_for_high_density_gui
}

set buffer_relative_star_scale $asarr_initial_settings(StelSkyDrawer.relativeStarScale)
frame .fr_gen_label002
label .l_gen_label002 -text $txt_rel -font $font_small
create_button_small .b_relstar0 $txt_init "send_ssc_of_relative_star_scale -"
#entry .e_relstar -font $font_small -width 4 -textvariable buffer_relative_star_scale
ttk::entry .e_relstar -font $font_small -width 4 -textvariable buffer_relative_star_scale
create_button_small .b_relstar1 $txt_arw_l "send_ssc_of_relative_star_scale -0.05"
create_button_small .b_relstar2 $txt_arw_r "send_ssc_of_relative_star_scale +0.05"
bind .e_relstar <Return> "send_ssc_of_relative_star_scale"
if { $flag_virtical_gui_of_star_scale != 0 } {
  pack .l_gen_label002 -expand 1 -side left -in .fr_gen_label002
} else {
  pack .l_gen_label002 -in .fr_gen_label002
}
pack .b_relstar0 -side left -fill both -in .fr_gen_label002
pack .e_relstar -side left -expand 1 -fill both -in .fr_gen_label002
pack .b_relstar1 .b_relstar2 -side left -fill both -in .fr_gen_label002

if { $flag_virtical_gui_of_star_scale != 0 } {
  pack .l_gen_label001002 .fr_gen_label001 .fr_gen_label002 -expand 1 -fill x -in .fr_gen_lbl01
} else {
  pack .fr_gen_label001 -side left -expand 1 -fill both -in .fr_gen_lbl01
  pack .fr_star_scale_margin -side left -in .fr_gen_lbl01
  pack .fr_gen_label002 -side left -expand 1 -fill both -in .fr_gen_lbl01
}

#

frame .fr_gen_lbl02

frame .fr_gen_label003
label .l_gen_label003 -text "$gui_tsl(METEOR_MARKER)" -font $font_small
create_button_small .b_metlbl0 "Off" "send_ssc_lines MeteorShowers.setEnableMarker(false)"
create_button_small .b_metlbl1 "ON" "send_ssc_lines MeteorShowers.setEnableMarker(true)"
pack .l_gen_label003 -in .fr_gen_label003
pack .b_metlbl0 .b_metlbl1 -side left -expand 1 -fill both -in .fr_gen_label003

frame .fr_meteor_margin -width $margin_for_high_density_gui

set buffer_meteor_zhr "0"
frame .fr_gen_label004
label .l_gen_label004 -text "$gui_tsl(METEOR_ZHR)" -font $font_small
create_button_small .b_metzhr0 "$gui_tsl(METEOR_ZERO)" "send_ssc_of_meteor_zhr -"
#entry .e_metzhr -font $font_small -width 5 -textvariable buffer_meteor_zhr
ttk::entry .e_metzhr -font $font_small -width 5 -textvariable buffer_meteor_zhr
create_button_small .b_metzhr1 "$gui_tsl(ARR_M_LEFT)" "send_ssc_of_meteor_zhr -1000"
create_button_small .b_metzhr2 "$gui_tsl(ARR_M_RIGHT)" "send_ssc_of_meteor_zhr +1000"
bind .e_metzhr <Return> "send_ssc_of_meteor_zhr"
pack .l_gen_label004 -in .fr_gen_label004
pack .b_metzhr0 -side left -expand 0 -fill both -in .fr_gen_label004
pack .e_metzhr  -side left -expand 1 -fill both -in .fr_gen_label004
pack .b_metzhr1 .b_metzhr2 -side left -expand 0 -fill both -in .fr_gen_label004

pack .fr_gen_label003 -side left -expand 1 -fill both -in .fr_gen_lbl02
pack .fr_meteor_margin -side left -in .fr_gen_lbl02
pack .fr_gen_label004 -side left -expand 1 -fill both -in .fr_gen_lbl02

#

frame .fr_gen_lbl03_margin -height $margin_for_high_density_gui

frame .fr_gen_lbl03

frame .fr_gen_label005
label .l_gen_label005 -textvariable textvariable_hougaku -font $font_small
create_button_small .b_gen_label005_1 "ON" "set_cardinal"
create_button_small .b_gen_label005_0 "Off" "exec_ssc_on_server unsetCardinal.ssc"
pack .l_gen_label005 -expand 1 -fill y -in .fr_gen_label005
pack .b_gen_label005_0 .b_gen_label005_1 -side left -expand 1 -fill x -in .fr_gen_label005

frame .fr_landscape_margin -width $margin_for_high_density_gui

set buffer_landscape_transparency $asarr_initial_settings(LandscapeMgr.landscapeTransparency)
frame .fr_gen_label006
frame .fr_gen_label006u
label .l_gen_label006 -text "$gui_tsl(LANDSCAPE)" -font $font_small
label .l_gen_label006_0 -text "$gui_tsl(LANDSCAPE_TRANSPARENCY)" -font $font_small
create_button_small .b_gen_label006_1 "$gui_tsl(INIT_S)" "send_ssc_of_landscape_transparency -"
#entry .e_land_trans -font $font_small -width 3 -textvariable buffer_landscape_transparency
ttk::entry .e_land_trans -font $font_small -width 3 -textvariable buffer_landscape_transparency
create_button_small .b_gen_label006_3 "ON" "send_ssc_of_flag_landscape true"
create_button_small .b_gen_label006_2 "Off" "send_ssc_of_flag_landscape false"
bind .e_land_trans <Return> "send_ssc_of_landscape_transparency"
pack .l_gen_label006 -side left -expand 1 -fill both -in .fr_gen_label006u
pack .l_gen_label006_0 .b_gen_label006_1 .e_land_trans -side left -expand 0 -fill both -in .fr_gen_label006u
pack .fr_gen_label006u -expand 1 -fill x -in .fr_gen_label006
pack .b_gen_label006_2 .b_gen_label006_3 -side left -expand 1 -fill x -in .fr_gen_label006

pack .fr_gen_label005 -side left -expand 1 -fill both -in .fr_gen_lbl03
pack .fr_landscape_margin -side left -in .fr_gen_lbl03
pack .fr_gen_label006 -side left -expand 1 -fill both -in .fr_gen_lbl03

#

frame .fr_gen_lbl04_margin -height $margin_for_high_density_gui

frame .fr_gen_lbl04

if { $flag_dome_mode != 0 } {
  label .l_gen_label007 -text "$gui_tsl(CHANGE_AZIMUTH)" -font $font_small
  #entry .e_azch_dt -font $font_small -width 2 -textvariable buffer_azchange_duration
  ttk::entry .e_azch_dt -font $font_small -width 2 -textvariable buffer_azchange_duration
  label .l_gen_label008 -text "$gui_tsl(CHANGE_AZ_SEC)" -font $font_small
  create_button_small .b_gen_label0080 "$gui_tsl(ARR_LEFT)" "update_azchange_duration -1"
  create_button_small .b_gen_label0081 "$gui_tsl(ARR_RIGHT)" "update_azchange_duration +1"
  bind .e_azch_dt <Return> "update_azchange_duration"
  pack .l_gen_label007 -side left -expand 1 -fill both -in .fr_gen_lbl04
  pack .e_azch_dt .l_gen_label008 .b_gen_label0080 .b_gen_label0081 -side left -expand 0 -fill both -in .fr_gen_lbl04
} else {
  label .l_gen_label007 -text "$gui_tsl(VIEW)" -font $font_small
  create_button_small .b_gen_label0080 "$gui_tsl(NORTH_S)" "send_ssc_of_view_azimuth 0"
  create_button_small .b_gen_label0081 "$gui_tsl(EAST_S)" "send_ssc_of_view_azimuth 90"
  create_button_small .b_gen_label0082 "$gui_tsl(SOUTH_S)" "send_ssc_of_view_azimuth 180"
  create_button_small .b_gen_label0083 "$gui_tsl(WEST_S)" "send_ssc_of_view_azimuth 270"
  create_button_small .b_gen_label0084 "$gui_tsl(VIEW_UP)" "send_ssc_of_view_altitude +5.0"
  pack .l_gen_label007 -side left -expand 1 -fill both -in .fr_gen_lbl04
  pack .b_gen_label0080 .b_gen_label0081 .b_gen_label0082 .b_gen_label0083 .b_gen_label0084 -side left -expand 0 -fill both -in .fr_gen_lbl04
}

frame .fr_gen_lbl05

if { $flag_dome_mode != 0 } {
  create_button_small .b_gen_label0090 "  0" "send_ssc_of_view_azimuth ++0"
  create_button_small .b_gen_label0091 " 90" "send_ssc_of_view_azimuth ++90"
  create_button_small .b_gen_label0092 "180" "send_ssc_of_view_azimuth ++180"
  create_button_small .b_gen_label0093 "270" "send_ssc_of_view_azimuth ++270"
  pack .b_gen_label0090 .b_gen_label0091 .b_gen_label0092 .b_gen_label0093 -side left -expand 1 -fill x -in .fr_gen_lbl05
} else {
  create_button_small .b_gen_label0090 "$gui_tsl(INIT)" "send_ssc_of_init_view_xyfov"
  create_button_small .b_gen_label0091 "$gui_tsl(VIEW_MINUS)"     "send_ssc_of_view_fov +5.0"
  create_button_small .b_gen_label0092 "$gui_tsl(VIEW_PLUS)"     "send_ssc_of_view_fov -5.0"
  create_button_small .b_gen_label0093 "$gui_tsl(VIEW_LEFT)"     "send_ssc_of_view_azimuth -10.0"
  create_button_small .b_gen_label0094 "$gui_tsl(VIEW_RIGHT)"     "send_ssc_of_view_azimuth +10.0"
  create_button_small .b_gen_label0095 "$gui_tsl(VIEW_DOWN)"     "send_ssc_of_view_altitude -5.0"
  pack .b_gen_label0090 -side left -expand 1 -fill x -in .fr_gen_lbl05
  pack .b_gen_label0091 .b_gen_label0092 .b_gen_label0093 .b_gen_label0094 .b_gen_label0095 -side left -expand 0 -fill x -in .fr_gen_lbl05
}

#

#frame .fr_land
#label .l_land -text "風景"
#create_button .b_land1 "ON" "send_ssc_of_flag_landscape true"
#create_button .b_land0 "Off" "send_ssc_of_flag_landscape false"
#pack .l_land -in .fr_land
#pack .b_land0 .b_land1 -side left -expand 1 -fill x -in .fr_land

#frame .fr_ordinal
#label .l_ordinal -text "方角"
#create_button .b_ordinal1 "ON" "set_cardinal"
#create_button .b_ordinal0 "Off" "exec_ssc_on_server unsetCardinal.ssc"
#pack .l_ordinal -in .fr_ordinal
#pack .b_ordinal0 .b_ordinal1 -side left -expand 1 -fill x -in .fr_ordinal

#

set buffer_location_latitude $asarr_initial_settings(Latitude)
set buffer_location_longitude $asarr_initial_settings(Longitude)
set buffer_location_altitude $asarr_initial_settings(Altitude)
set buffer_location_planet $asarr_initial_settings(Planet)

set planets {
  "Sun"
  "Mercury"
  "Venus"
  "Earth"
  "Moon"
  "Mars"
  "Jupiter"
  "Saturn"
  "Uranus"
  "Neptune"
}

frame .fr_location0_margin -height $margin_for_high_density_gui

if { $flag_dome_mode != 0 } {
  set cbwidth_loc_planet 6
} else {
  set cbwidth_loc_planet 6
}

frame .fr_location0
label .l_location -text "$gui_tsl(LOCATION)" -font $font_small
ttk::combobox .cb_loc_planet -textvariable buffer_location_planet -values $planets -font $font_small -width $cbwidth_loc_planet -state readonly
bind .cb_loc_planet <<ComboboxSelected>> { send_ssc_of_location_planet }
label .l_loc_alt -text "$gui_tsl(LOCATION_ALTITUDE)" -font $font_small
create_button_small .b_loc_alt0 "$gui_tsl(INIT_S)" "send_ssc_of_location_altitude -"
#entry .e_loc_alt -font $font_small -width 4 -textvariable buffer_location_altitude
ttk::entry .e_loc_alt -font $font_small -width 4 -textvariable buffer_location_altitude
bind .e_loc_alt <Return> "send_ssc_of_location_altitude"
label .l_loc_meter -text "m" -font $font_small
pack .l_location -side left -fill both -in .fr_location0
pack .cb_loc_planet -expand 1 -side left -fill x -in .fr_location0
pack .l_loc_alt .b_loc_alt0 .e_loc_alt -side left -fill both -in .fr_location0
if { $flag_large_gui != 0 } {
  pack .l_loc_meter -side left -fill both -in .fr_location0
}

frame .fr_location1
label .l_loc_lat -text "$gui_tsl(LOCATION_LATITUDE)" -font $font_small
create_button_small .b_loc_lat0 "$gui_tsl(INIT_S)" "send_ssc_of_location_latitude -"
#entry .e_loc_lat -font $font_small -width 8 -textvariable buffer_location_latitude
ttk::entry .e_loc_lat -font $font_small -width 8 -textvariable buffer_location_latitude
bind .e_loc_lat <Return> "send_ssc_of_location_latitude"
create_button_small .b_loc_lat1 "$gui_tsl(LOCATION_SOUTH)" "send_ssc_of_location_latitude -5.0"
create_button_small .b_loc_lat2 "$gui_tsl(LOCATION_NORTH)" "send_ssc_of_location_latitude +5.0"
pack .l_loc_lat .b_loc_lat0 -side left -fill both -in .fr_location1
pack .e_loc_lat -expand 1 -side left -fill both -in .fr_location1
pack .b_loc_lat1 .b_loc_lat2 -side left -fill both -in .fr_location1

frame .fr_location2
label .l_loc_lon -text "$gui_tsl(LOCATION_LONGITUDE)" -font $font_small
create_button_small .b_loc_lon0 "$gui_tsl(INIT_S)" "send_ssc_of_location_longitude -"
#entry .e_loc_lon -font $font_small -width 8 -textvariable buffer_location_longitude
ttk::entry .e_loc_lon -font $font_small -width 8 -textvariable buffer_location_longitude
bind .e_loc_lon <Return> "send_ssc_of_location_longitude"
create_button_small .b_loc_lon1 "$gui_tsl(LOCATION_WEST)" "send_ssc_of_location_longitude -5.0"
create_button_small .b_loc_lon2 "$gui_tsl(LOCATION_EAST)" "send_ssc_of_location_longitude +5.0"
pack .l_loc_lon .b_loc_lon0 -side left -fill both -in .fr_location2
pack .e_loc_lon -expand 1 -side left -fill both -in .fr_location2
pack .b_loc_lon1 .b_loc_lon2 -side left -fill both -in .fr_location2


#frame .fr_loclat
#label .l_loclat -text "観測地 緯度" -font $font_small
#create_button_small .b_loclat0 " 初 " "send_ssc_of_location_latitude -"
#entry .e_loclat -width 10 -textvariable buffer_location_latitude -font $font_small
#create_button_small .b_loclat1 "$gui_tsl(ARR_LEFT)" "send_ssc_of_location_latitude -5.0"
#create_button_small .b_loclat2 "$gui_tsl(ARR_RIGHT)" "send_ssc_of_location_latitude +5.0"
#bind .e_loclat <Return> "send_ssc_of_location_latitude"
#pack .l_loclat -in .fr_loclat
#pack .b_loclat0 -side left -fill both -in .fr_loclat
#pack .e_loclat -expand 1 -side left -fill both -in .fr_loclat
#pack .b_loclat1 .b_loclat2 -side left -fill both -in .fr_loclat

#

set buffer_min_fps $asarr_initial_settings(MinFps)
frame .fr_minfps_margin -height $margin_for_high_density_gui
frame .fr_minfps
label .l_minfps -text "$gui_tsl(MIN_FPS)" -font $font_small
create_button_small .b_minfps0 "$gui_tsl(INIT_S)" "send_ssc_of_min_fps -"
#entry .e_minfps -font $font_small -width 5 -textvariable buffer_min_fps
ttk::entry .e_minfps -font $font_small -width 5 -textvariable buffer_min_fps
create_button_small .b_minfps1 "$gui_tsl(ARR_LEFT)" "send_ssc_of_min_fps -1.0"
create_button_small .b_minfps2 "$gui_tsl(ARR_RIGHT)" "send_ssc_of_min_fps +1.0"
bind .e_minfps <Return> "send_ssc_of_min_fps"
pack .l_minfps -expand 1 -side left -fill both -in .fr_minfps
pack .b_minfps0 .e_minfps -side left -fill both -in .fr_minfps
pack .b_minfps1 .b_minfps2 -side left -fill both -in .fr_minfps

pack .fr_init .fr_tmrate .fr_illumi .fr_atmos .fr_milky .fr_gen_lbl01 .fr_gen_lbl02 .fr_gen_lbl03_margin .fr_gen_lbl03 -expand 0 -fill x -in .lf_general
if { 1 } {
  pack .fr_gen_lbl04_margin .fr_gen_lbl04 .fr_gen_lbl05 -expand 0 -fill x -in .lf_general
}
pack .fr_location0_margin .fr_location0 .fr_location1 .fr_location2 .fr_minfps_margin .fr_minfps -expand 0 -fill x -in .lf_general

####

if { $flag_host_gui != 0 && $flag_dome_mode != 0 } {

  frame .fr_datetm_margin -height $margin_for_high_density_gui
  frame .fr_datetm
  label .l_datetm -text "$gui_tsl(CLOCK)" -font $font_small
  create_button_small .b_datetm0 "Off" "kill_date_monitor"
  create_button_small .b_datetm1 "A" "exec_date_monitor a"
  create_button_small .b_datetm2 "B" "exec_date_monitor b"
  create_button_small .b_datetm3 "ON" "exec_date_monitor ab"
  create_button_small .b_datetm4 "$gui_tsl(CLOCK_ADJUSTMENT)" "exec_date_monitor grid"
  pack .l_datetm .b_datetm0 .b_datetm1 .b_datetm2 .b_datetm3 .b_datetm4 -side left -expand 1 -fill x -in .fr_datetm

  pack .fr_datetm_margin .fr_datetm -expand 0 -fill x -in .lf_general

}

.pw add .lf_general


################################################################

labelframe .lf_constel -text "Constellation" -font $font_labelframe

frame .fr_name0
create_button_code .b_con_reset "$gui_tsl(GROUP_RESET)" "reset_constellation"
label .l_name -text "$gui_tsl(CONSTELLATION_LABELS)"
pack .b_con_reset -anchor n -pady [list 0 $pad_bottom_for_group_reset_button] -side left -in .fr_name0
pack .l_name  -anchor s -side left -expand 1 -fill x -in .fr_name0
frame .fr_name1
create_button .b_name1 "ON" "send_ssc_lines ConstellationMgr.setFlagLabels(true)"
create_button .b_name0 "Off" "send_ssc_lines ConstellationMgr.setFlagLabels(false)"
pack .b_name0 .b_name1 -side left -expand 1 -fill x -in .fr_name1

frame .fr_line
label .l_line -text "$gui_tsl(CONSTELLATION_LINES)"
create_button .b_line1 "ON" "send_ssc_lines ConstellationMgr.setFlagLines(true)"
create_button .b_line0 "Off" "send_ssc_lines ConstellationMgr.setFlagLines(false)"
pack .l_line -in .fr_line
pack .b_line0 .b_line1 -side left -expand 1 -fill x -in .fr_line

frame .fr_art
label .l_art -text "$gui_tsl(CONSTELLATION_ART)"
create_button .b_art0 "Off" "send_ssc_lines ConstellationMgr.setFlagArt(false)"
create_button .b_art1 "1" "send_ssc_lines ConstellationMgr.setFlagArt(true) ConstellationMgr.setArtIntensity(0.1)"
create_button .b_art2 "2" "send_ssc_lines ConstellationMgr.setFlagArt(true) ConstellationMgr.setArtIntensity(0.2)"
create_button .b_art3 "3" "send_ssc_lines ConstellationMgr.setFlagArt(true) ConstellationMgr.setArtIntensity(0.3)"
create_button .b_art4 "4" "send_ssc_lines ConstellationMgr.setFlagArt(true) ConstellationMgr.setArtIntensity(0.4)"
create_button .b_art5 "5" "send_ssc_lines ConstellationMgr.setFlagArt(true) ConstellationMgr.setArtIntensity(0.5)"
pack .l_art -in .fr_art
pack .b_art0 .b_art1 .b_art2 .b_art3 .b_art4 .b_art5 -side left -expand 1 -fill x -in .fr_art

frame .fr_boun
label .l_boun -text "$gui_tsl(CONSTELLATION_BOUNDARIES)"
create_button .b_boun1 "ON" "send_ssc_lines ConstellationMgr.setFlagBoundaries(true)"
create_button .b_boun0 "Off" "send_ssc_lines ConstellationMgr.setFlagBoundaries(false)"
pack .l_boun -in .fr_boun
pack .b_boun0 .b_boun1 -side left -expand 1 -fill x -in .fr_boun

frame .fr_astername
label .l_astername -text "$gui_tsl(ASTERISM_LABELS)"
create_button .b_astername0 " Off " "send_ssc_lines AsterismMgr.setFlagLabels(false)"
create_button .b_astername1 " ON "  "send_ssc_lines AsterismMgr.setFlagLabels(true)"
pack .l_astername -in .fr_astername
pack .b_astername0 .b_astername1 -side left -expand 1 -fill x -in .fr_astername

# アステリズムは内部変数の初期化にバグがあるらしく、
# それに対するStellariumスクリプトが以下に含まれる

frame .fr_aster
label .l_aster -text "$gui_tsl(ASTERISM)"
# よくわからないが、deselectAsterisms() を2回呼び出す事で安定するようになる
create_button .b_aster0 "Off" "send_ssc_lines AsterismMgr.setFlagIsolateAsterismSelected(true) AsterismMgr.deselectAsterisms() AsterismMgr.deselectAsterisms()"
# selectAllAsterisms() をいきなり使うと、AsterismMgr の挙動がおかしくなる。
# 何か１つオブジェクトを選択した後 selectAllAsterisms() すると期待通り動作するが、
# Stellarium-25.4だとクラッシュする
#create_button .b_aster1 "全" "send_ssc_lines AsterismMgr.selectAsterism('Teapot') AsterismMgr.selectAllAsterisms() AsterismMgr.setFlagLines(true)"
# selectAllAsterisms()を使わない安全な実装
create_button .b_aster1 "$gui_tsl(ASTERISM_ALL)" "send_ssc_lines AsterismMgr.setFlagIsolateAsterismSelected(false) AsterismMgr.setFlagLines(true)"
pack .l_aster -in .fr_aster
pack .b_aster0 -side left -expand 1 -fill x -in .fr_aster
pack .b_aster1 -side left -expand 0 -fill x -in .fr_aster

frame .fr_all
label .l_all -text "$gui_tsl(CONSTELLATION_SELECTION)"
create_button .b_all2 "$gui_tsl(CONSTELLATION_A88)" "exec_ssc_on_server setConstellationAll.ssc"
create_button .b_all1 "$gui_tsl(CONSTELLATION_E12)" "exec_ssc_on_server setEclipticConstellationAll.ssc"
create_button .b_all0 "Unset" "exec_ssc_on_server unsetConstellationAll.ssc"
pack .l_all -in .fr_all
pack .b_all0 .b_all1 .b_all2 -side left -expand 1 -fill x -in .fr_all

if { 25 <= [get_stellarium_major_version] } {
  frame .fr_zodiac
  label .l_zodiac -text "$gui_tsl(CONSTELLATION_ZODIAC)"
  create_button .b_zodiac0 " Off " "send_ssc_lines ConstellationMgr.setFlagZodiac(false)"
  create_button .b_zodiac1 " ON "  "send_ssc_lines ConstellationMgr.setFlagZodiac(true)"
  pack .l_zodiac -in .fr_zodiac
  pack .b_zodiac0 .b_zodiac1 -side left -expand 1 -fill x -in .fr_zodiac
}

frame .fr_strlabel
label .l_strlabel -text "$gui_tsl(STELLAR_LABELS)"
create_button .b_strlabel0 "Off" "send_ssc_of_stellarlabels -"
#entry .e_strlabel -width 4 -textvariable buffer_stellarlabels
ttk::entry .e_strlabel -width 4 -textvariable buffer_stellarlabels
set buffer_stellarlabels "0.0"
create_button .b_strlabel1 "$gui_tsl(ARR_LEFT)" "send_ssc_of_stellarlabels -0.1"
create_button .b_strlabel2 "$gui_tsl(ARR_RIGHT)" "send_ssc_of_stellarlabels +0.1"
bind .e_strlabel <Return> "send_ssc_of_stellarlabels"
pack .l_strlabel -in .fr_strlabel
pack .b_strlabel0 -side left -fill both -in .fr_strlabel
pack .e_strlabel -expand 1 -side left -fill both -in .fr_strlabel
pack .b_strlabel1 .b_strlabel2 -side left -fill both -in .fr_strlabel

pack .fr_name0 .fr_name1 .fr_line .fr_art .fr_boun .fr_astername .fr_aster .fr_all -expand 0 -fill x -in .lf_constel
if { 25 <= [get_stellarium_major_version] } {
  pack .fr_zodiac -expand 0 -fill x -in .lf_constel
}
pack .fr_strlabel -expand 0 -fill x -in .lf_constel

.pw add .lf_constel


################################################################
# 星座 春

labelframe .lf_spring -text "Spring Constel." -font $font_labelframe

# おおぐま座
frame .fr_UMa
label .l_UMa -text "$gui_tsl(CON_UMA)"
create_button .b_UMa1 " SET " "update_constellations true Ursa~Major"
create_button .b_UMa0 "Unset" "update_constellations false Ursa~Major"
pack .l_UMa -in .fr_UMa
pack .b_UMa0 .b_UMa1 -side left -expand 1 -fill x -in .fr_UMa

# こぐま座
frame .fr_UMi
label .l_UMi -text "$gui_tsl(CON_UMI)"
create_button .b_UMi1 " SET " "update_constellations true Ursa~Minor"
create_button .b_UMi0 "Unset" "update_constellations false Ursa~Minor"
pack .l_UMi -in .fr_UMi
pack .b_UMi0 .b_UMi1 -side left -expand 1 -fill x -in .fr_UMi

# しし座
frame .fr_Leo
label .l_Leo -text "$gui_tsl(CON_LEO)"
create_button .b_Leo1 " SET ,8" "update_constellations true Leo"
create_button .b_Leo0 "Unset,8" "update_constellations false Leo"
pack .l_Leo -in .fr_Leo
pack .b_Leo0 .b_Leo1 -side left -expand 1 -fill x -in .fr_Leo

# うしかい座
frame .fr_Boo
label .l_Boo -text "$gui_tsl(CON_BOO)"
create_button .b_Boo1 " SET " "update_constellations true Bootes"
create_button .b_Boo0 "Unset" "update_constellations false Bootes"
pack .l_Boo -in .fr_Boo
pack .b_Boo0 .b_Boo1 -side left -expand 1 -fill x -in .fr_Boo

# おとめ座
frame .fr_Vir
label .l_Vir -text "$gui_tsl(CON_VIR)"
create_button .b_Vir1 " SET " "update_constellations true Virgo"
create_button .b_Vir0 "Unset" "update_constellations false Virgo"
pack .l_Vir -in .fr_Vir
pack .b_Vir0 .b_Vir1 -side left -expand 1 -fill x -in .fr_Vir

frame .fr_cnst_lbl01

# からす座
frame .fr_Crv
label .l_Crv -text "$gui_tsl(CON_CRV)"
create_button_small .b_Crv1 "SET" "update_constellations true Corvus"
create_button_small .b_Crv0 "Unset" "update_constellations false Corvus"
pack .l_Crv -in .fr_Crv
pack .b_Crv0 .b_Crv1 -side left -expand 1 -fill x -in .fr_Crv

# かに座
frame .fr_Cnc
label .l_Cnc -text "$gui_tsl(CON_CNC)"
create_button_small .b_Cnc1 "SET" "update_constellations true Cancer"
create_button_small .b_Cnc0 "Unset" "update_constellations false Cancer"
pack .l_Cnc -in .fr_Cnc
pack .b_Cnc0 .b_Cnc1 -side left -expand 1 -fill x -in .fr_Cnc

pack .fr_Crv .fr_Cnc -side left -expand 1 -fill x -in .fr_cnst_lbl01

# かみのけ座
frame .fr_Com
label .l_Com -text "$gui_tsl(CON_COM)" -font $font_small
create_button_small .b_Com1 " SET " "update_constellations true Coma~Berenices"
create_button_small .b_Com0 "Unset" "update_constellations false Coma~Berenices"
pack .l_Com -in .fr_Com
pack .b_Com0 .b_Com1 -side left -expand 1 -fill x -in .fr_Com

# りょうけん座
frame .fr_CVn
label .l_CVn -text "$gui_tsl(CON_CVN)" -font $font_small
create_button_small .b_CVn1 " SET " "update_constellations true Canes~Venatici"
create_button_small .b_CVn0 "Unset" "update_constellations false Canes~Venatici"
pack .l_CVn -in .fr_CVn
pack .b_CVn0 .b_CVn1 -side left -expand 1 -fill x -in .fr_CVn

frame .fr_cnst_lbl02

# うみへび座
frame .fr_Hya
label .l_Hya -text "$gui_tsl(CON_HYA)" -font $font_small
create_button_small .b_Hya1 "SET" "update_constellations true Hydra"
create_button_small .b_Hya0 "Unset" "update_constellations false Hydra"
pack .l_Hya -in .fr_Hya
pack .b_Hya0 .b_Hya1 -side left -expand 1 -fill x -in .fr_Hya

# コップ座
frame .fr_Crt
label .l_Crt -text "$gui_tsl(CON_CRT)" -font $font_small
create_button_small .b_Crt1 "SET" "update_constellations true Crater"
create_button_small .b_Crt0 "Unset" "update_constellations false Crater"
pack .l_Crt -in .fr_Crt
pack .b_Crt0 .b_Crt1 -side left -expand 1 -fill x -in .fr_Crt

pack .fr_Hya .fr_Crt -side left -expand 1 -fill x -in .fr_cnst_lbl02

# ケンタウルス座
frame .fr_Cen
label .l_Cen -text "$gui_tsl(CON_CEN)" -font $font_small
create_button_small .b_Cen1 " SET " "update_constellations true Centaurus"
create_button_small .b_Cen0 "Unset" "update_constellations false Centaurus"
pack .l_Cen -in .fr_Cen
pack .b_Cen0 .b_Cen1 -side left -expand 1 -fill x -in .fr_Cen

# みなみじゅうじ座
frame .fr_Cru
label .l_Cru -text "$gui_tsl(CON_CRU)" -font $font_small
create_button_small .b_Cru1 " SET " "update_constellations true Crux"
create_button_small .b_Cru0 "Unset" "update_constellations false Crux"
pack .l_Cru -in .fr_Cru
pack .b_Cru0 .b_Cru1 -side left -expand 1 -fill x -in .fr_Cru

pack .fr_UMa .fr_UMi .fr_Leo .fr_Boo .fr_Vir .fr_cnst_lbl01 .fr_Com .fr_CVn .fr_cnst_lbl02 .fr_Cen .fr_Cru -expand 0 -fill x -in .lf_spring

.pw add .lf_spring

################################################################
# 星座 夏

labelframe .lf_summer -text "Summer Constel." -font $font_labelframe

# はくちょう座
frame .fr_cyg
label .l_cyg -text "$gui_tsl(CON_CYG)"
create_button .b_cyg1 " SET " "update_constellations true Cygnus"
create_button .b_cyg0 "Unset" "update_constellations false Cygnus"
pack .l_cyg -in .fr_cyg
pack .b_cyg0 .b_cyg1 -side left -expand 1 -fill x -in .fr_cyg

# こと座
frame .fr_lyr
label .l_lyr -text "$gui_tsl(CON_LYR)"
create_button .b_lyr1 " SET " "update_constellations true Lyra"
create_button .b_lyr0 "Unset" "update_constellations false Lyra"
pack .l_lyr -in .fr_lyr
pack .b_lyr0 .b_lyr1 -side left -expand 1 -fill x -in .fr_lyr

# わし座
frame .fr_aql
label .l_aql -text "$gui_tsl(CON_AQL)"
create_button .b_aql1 " SET " "update_constellations true Aquila"
create_button .b_aql0 "Unset" "update_constellations false Aquila"
pack .l_aql -in .fr_aql
pack .b_aql0 .b_aql1 -side left -expand 1 -fill x -in .fr_aql

# さそり座
frame .fr_Sco
label .l_Sco -text "$gui_tsl(CON_SCO)"
create_button .b_Sco1 " SET " "update_constellations true Scorpius"
create_button .b_Sco0 "Unset" "update_constellations false Scorpius"
pack .l_Sco -in .fr_Sco
pack .b_Sco0 .b_Sco1 -side left -expand 1 -fill x -in .fr_Sco

# いて座
frame .fr_Sgr
label .l_Sgr -text "$gui_tsl(CON_SGR)"
create_button .b_Sgr1 " SET " "update_constellations true Sagittarius"
create_button .b_Sgr0 "Unset" "update_constellations false Sagittarius"
pack .l_Sgr -in .fr_Sgr
pack .b_Sgr0 .b_Sgr1 -side left -expand 1 -fill x -in .fr_Sgr

# てんびん座
frame .fr_Lib
label .l_Lib -text "$gui_tsl(CON_LIB)"
create_button .b_Lib1 " SET " "update_constellations true Libra"
create_button .b_Lib0 "Unset" "update_constellations false Libra"
pack .l_Lib -in .fr_Lib
pack .b_Lib0 .b_Lib1 -side left -expand 1 -fill x -in .fr_Lib

# ヘルクレス座
frame .fr_Her
label .l_Her -text "$gui_tsl(CON_HER)"
create_button .b_Her1 " SET " "update_constellations true Hercules"
create_button .b_Her0 "Unset" "update_constellations false Hercules"
pack .l_Her -in .fr_Her
pack .b_Her0 .b_Her1 -side left -expand 1 -fill x -in .fr_Her

# かんむり座
frame .fr_CrB
label .l_CrB -text "$gui_tsl(CON_CRB)" -font $font_small
create_button_small .b_CrB1 " SET " "update_constellations true Corona~Borealis"
create_button_small .b_CrB0 "Unset" "update_constellations false Corona~Borealis"
pack .l_CrB -in .fr_CrB
pack .b_CrB0 .b_CrB1 -side left -expand 1 -fill x -in .fr_CrB

# へびつかい座
frame .fr_Oph
label .l_Oph -text "$gui_tsl(CON_OPH)" -font $font_small
create_button_small .b_Oph1 " SET " "update_constellations true Ophiuchus"
create_button_small .b_Oph0 "Unset" "update_constellations false Ophiuchus"
pack .l_Oph -in .fr_Oph
pack .b_Oph0 .b_Oph1 -side left -expand 1 -fill x -in .fr_Oph

#

frame .fr_cnst_lbl11

# へび座
frame .fr_Ser
label .l_Ser -text "$gui_tsl(CON_SER)" -font $font_small
create_button_small .b_Ser1 "SET" "update_constellations true Serpens"
create_button_small .b_Ser0 "Unset" "update_constellations false Serpens"
pack .l_Ser -in .fr_Ser
pack .b_Ser0 .b_Ser1 -side left -expand 1 -fill x -in .fr_Ser

# りゅう座
frame .fr_Dra
label .l_Dra -text "$gui_tsl(CON_DRA)" -font $font_small
create_button_small .b_Dra1 "SET"   "update_constellations true Draco"
create_button_small .b_Dra0 "Unset" "update_constellations false Draco"
pack .l_Dra -in .fr_Dra
pack .b_Dra0 .b_Dra1 -side left -expand 1 -fill x -in .fr_Dra

pack .fr_Ser .fr_Dra  -side left -expand 1 -fill x -in .fr_cnst_lbl11

#

frame .fr_cnst_lbl12

# いるか座
frame .fr_Del
label .l_Del -text "$gui_tsl(CON_DEL)" -font $font_small
create_button_small .b_Del1 "SET"   "update_constellations true Delphinus"
create_button_small .b_Del0 "Unset" "update_constellations false Delphinus"
pack .l_Del -in .fr_Del
pack .b_Del0 .b_Del1 -side left -expand 1 -fill x -in .fr_Del

# おおかみ座
frame .fr_Lup
label .l_Lup -text "$gui_tsl(CON_LUP)" -font $font_small
create_button_small .b_Lup1 "SET"   "update_constellations true Lupus"
create_button_small .b_Lup0 "Unset" "update_constellations false Lupus"
pack .l_Lup -in .fr_Lup
pack .b_Lup0 .b_Lup1 -side left -expand 1 -fill x -in .fr_Lup

pack .fr_Del .fr_Lup  -side left -expand 1 -fill x -in .fr_cnst_lbl12

#

pack .fr_cyg .fr_lyr .fr_aql .fr_Sco .fr_Sgr .fr_Lib .fr_Her .fr_CrB .fr_Oph .fr_cnst_lbl11 .fr_cnst_lbl12  -expand 0 -fill x -in .lf_summer

.pw add .lf_summer

################################################################
# 星座 秋

labelframe .lf_autumn -text "Autumn Constel." -font $font_labelframe

# カシオペヤ座
frame .fr_Cas
label .l_Cas -text "$gui_tsl(CON_CAS)"
create_button .b_Cas1 " SET " "update_constellations true Cassiopeia"
create_button .b_Cas0 "Unset" "update_constellations false Cassiopeia"
pack .l_Cas -in .fr_Cas
pack .b_Cas0 .b_Cas1 -side left -expand 1 -fill x -in .fr_Cas

# ペガスス座
frame .fr_Peg
label .l_Peg -text "$gui_tsl(CON_PEG)"
create_button .b_Peg1 " SET " "update_constellations true Pegasus"
create_button .b_Peg0 "Unset" "update_constellations false Pegasus"
pack .l_Peg -in .fr_Peg
pack .b_Peg0 .b_Peg1 -side left -expand 1 -fill x -in .fr_Peg

# アンドロメダ座
frame .fr_And
label .l_And -text "$gui_tsl(CON_AND)"
create_button .b_And1 " SET " "update_constellations true Andromeda"
create_button .b_And0 "Unset" "update_constellations false Andromeda"
pack .l_And -in .fr_And
pack .b_And0 .b_And1 -side left -expand 1 -fill x -in .fr_And

# ペルセウス座
frame .fr_Per
label .l_Per -text "$gui_tsl(CON_PER)"
create_button .b_Per1 " SET " "update_constellations true Perseus"
create_button .b_Per0 "Unset" "update_constellations false Perseus"
pack .l_Per -in .fr_Per
pack .b_Per0 .b_Per1 -side left -expand 1 -fill x -in .fr_Per

# ケフェウス座
frame .fr_Cep
label .l_Cep -text "$gui_tsl(CON_CEP)"
create_button .b_Cep1 " SET " "update_constellations true Cepheus"
create_button .b_Cep0 "Unset" "update_constellations false Cepheus"
pack .l_Cep -in .fr_Cep
pack .b_Cep0 .b_Cep1 -side left -expand 1 -fill x -in .fr_Cep

# うお座
frame .fr_Psc
label .l_Psc -text "$gui_tsl(CON_PSC)"
create_button .b_Psc1 " SET " "update_constellations true Pisces"
create_button .b_Psc0 "Unset" "update_constellations false Pisces"
pack .l_Psc -in .fr_Psc
pack .b_Psc0 .b_Psc1 -side left -expand 1 -fill x -in .fr_Psc

# くじら座
frame .fr_Cet
label .l_Cet -text "$gui_tsl(CON_CET)"
create_button .b_Cet1 " SET " "update_constellations true Cetus"
create_button .b_Cet0 "Unset" "update_constellations false Cetus"
pack .l_Cet -in .fr_Cet
pack .b_Cet0 .b_Cet1 -side left -expand 1 -fill x -in .fr_Cet

# みなみのうお座
frame .fr_PsA
label .l_PsA -text "$gui_tsl(CON_PSA)" -font $font_small
create_button_small .b_PsA1 " SET " "update_constellations true Piscis~Austrinus"
create_button_small .b_PsA0 "Unset" "update_constellations false Piscis~Austrinus"
pack .l_PsA -in .fr_PsA
pack .b_PsA0 .b_PsA1 -side left -expand 1 -fill x -in .fr_PsA

#

frame .fr_cnst_lbl21

# みずがめ座
frame .fr_Aqr
label .l_Aqr -text "$gui_tsl(CON_AQR)" -font $font_small
create_button_small .b_Aqr1 "SET" "update_constellations true Aquarius"
create_button_small .b_Aqr0 "Unset" "update_constellations false Aquarius"
pack .l_Aqr -in .fr_Aqr
pack .b_Aqr0 .b_Aqr1 -side left -expand 1 -fill x -in .fr_Aqr

# おひつじ座
frame .fr_Ari
label .l_Ari -text "$gui_tsl(CON_ARI)" -font $font_small
create_button_small .b_Ari1 "SET"   "update_constellations true Aries"
create_button_small .b_Ari0 "Unset" "update_constellations false Aries"
pack .l_Ari -in .fr_Ari
pack .b_Ari0 .b_Ari1 -side left -expand 1 -fill x -in .fr_Ari

pack .fr_Aqr .fr_Ari  -side left -expand 1 -fill x -in .fr_cnst_lbl21

#

frame .fr_cnst_lbl22

# やぎ座
frame .fr_Cap
label .l_Cap -text "$gui_tsl(CON_CAP)" -font $font_small
create_button_small .b_Cap1 "SET"   "update_constellations true Capricornus"
create_button_small .b_Cap0 "Unset" "update_constellations false Capricornus"
pack .l_Cap -in .fr_Cap
pack .b_Cap0 .b_Cap1 -side left -expand 1 -fill x -in .fr_Cap

# つる座
frame .fr_Gru
label .l_Gru -text "$gui_tsl(CON_GRU)" -font $font_small
create_button_small .b_Gru1 "SET"   "update_constellations true Grus"
create_button_small .b_Gru0 "Unset" "update_constellations false Grus"
pack .l_Gru -in .fr_Gru
pack .b_Gru0 .b_Gru1 -side left -expand 1 -fill x -in .fr_Gru

pack .fr_Cap .fr_Gru -side left -expand 1 -fill x -in .fr_cnst_lbl22

#

# ちょうこくしつ座
frame .fr_Scl
label .l_Scl -text "$gui_tsl(CON_SCL)" -font $font_small
create_button_small .b_Scl1 " SET " "update_constellations true Sculptor"
create_button_small .b_Scl0 "Unset" "update_constellations false Sculptor"
pack .l_Scl -in .fr_Scl
pack .b_Scl0 .b_Scl1 -side left -expand 1 -fill x -in .fr_Scl

pack .fr_Cas .fr_Peg .fr_And .fr_Per .fr_Cep .fr_Psc .fr_Cet .fr_PsA .fr_cnst_lbl21 .fr_cnst_lbl22 .fr_Scl -expand 0 -fill x -in .lf_autumn

.pw add .lf_autumn

################################################################
# 星座 冬
labelframe .lf_winter -text "Winter Constel." -font $font_labelframe

# オリオン座
frame .fr_Ori
label .l_Ori -text "$gui_tsl(CON_ORI)"
create_button .b_Ori1 " SET ,8" "update_constellations true Orion"
create_button .b_Ori0 "Unset,8" "update_constellations false Orion"
pack .l_Ori -in .fr_Ori
pack .b_Ori0 .b_Ori1 -side left -expand 1 -fill x -in .fr_Ori

# おおいぬ座
frame .fr_CMa
label .l_CMa -text "$gui_tsl(CON_CMA)"
create_button .b_CMa1 " SET " "update_constellations true Canis~Major"
create_button .b_CMa0 "Unset" "update_constellations false Canis~Major"
pack .l_CMa -in .fr_CMa
pack .b_CMa0 .b_CMa1 -side left -expand 1 -fill x -in .fr_CMa

# こいぬ座
frame .fr_CMi
label .l_CMi -text "$gui_tsl(CON_CMI)"
create_button .b_CMi1 " SET " "update_constellations true Canis~Minor"
create_button .b_CMi0 "Unset" "update_constellations false Canis~Minor"
pack .l_CMi -in .fr_CMi
pack .b_CMi0 .b_CMi1 -side left -expand 1 -fill x -in .fr_CMi

# ふたご座
frame .fr_Gem
label .l_Gem -text "$gui_tsl(CON_GEM)"
create_button .b_Gem1 " SET " "update_constellations true Gemini"
create_button .b_Gem0 "Unset" "update_constellations false Gemini"
pack .l_Gem -in .fr_Gem
pack .b_Gem0 .b_Gem1 -side left -expand 1 -fill x -in .fr_Gem

# おうし座
frame .fr_Tau
label .l_Tau -text "$gui_tsl(CON_TAU)"
create_button .b_Tau1 " SET " "update_constellations true Taurus"
create_button .b_Tau0 "Unset" "update_constellations false Taurus"
pack .l_Tau -in .fr_Tau
pack .b_Tau0 .b_Tau1 -side left -expand 1 -fill x -in .fr_Tau

# ぎょしゃ座
frame .fr_Aur
label .l_Aur -text "$gui_tsl(CON_AUR)"
create_button .b_Aur1 " SET " "update_constellations true Auriga"
create_button .b_Aur0 "Unset" "update_constellations false Auriga"
pack .l_Aur -in .fr_Aur
pack .b_Aur0 .b_Aur1 -side left -expand 1 -fill x -in .fr_Aur

#frame .fr_Ari_w
#label .l_Ari_w -text "$gui_tsl(CON_ARI)" -font $font_small
#create_button_small .b_Ari_w1 " SET " "update_constellations true Aries"
#create_button_small .b_Ari_w0 "Unset" "update_constellations false Aries"
#pack .l_Ari_w -in .fr_Ari_w
#pack .b_Ari_w0 .b_Ari_w1 -side left -expand 1 -fill x -in .fr_Ari_w

frame .fr_cnst_lbl31

# うさぎ座
frame .fr_Lep
label .l_Lep -text "$gui_tsl(CON_LEP)"
create_button_small .b_Lep1 "SET" "update_constellations true Lepus"
create_button_small .b_Lep0 "Unset" "update_constellations false Lepus"
pack .l_Lep -in .fr_Lep
pack .b_Lep0 .b_Lep1 -side left -expand 1 -fill x -in .fr_Lep

# はと座
frame .fr_Col
label .l_Col -text "$gui_tsl(CON_COL)"
create_button_small .b_Col1 "SET" "update_constellations true Columba"
create_button_small .b_Col0 "Unset" "update_constellations false Columba"
pack .l_Col -in .fr_Col
pack .b_Col0 .b_Col1 -side left -expand 1 -fill x -in .fr_Col

pack .fr_Lep .fr_Col -side left -expand 1 -fill x -in .fr_cnst_lbl31

# いっかくじゅう座
frame .fr_Mon
label .l_Mon -text "$gui_tsl(CON_MON)" -font $font_small
create_button_small .b_Mon1 " SET " "update_constellations true Monoceros"
create_button_small .b_Mon0 "Unset" "update_constellations false Monoceros"
pack .l_Mon -in .fr_Mon
pack .b_Mon0 .b_Mon1 -side left -expand 1 -fill x -in .fr_Mon

# きりん座
frame .fr_Cam
label .l_Cam -text "$gui_tsl(CON_CAM)" -font $font_small
create_button_small .b_Cam1 " SET " "update_constellations true Camelopardalis"
create_button_small .b_Cam0 "Unset" "update_constellations false Camelopardalis"
pack .l_Cam -in .fr_Cam
pack .b_Cam0 .b_Cam1 -side left -expand 1 -fill x -in .fr_Cam

# やまねこ座
frame .fr_Lyn
label .l_Lyn -text "$gui_tsl(CON_LYN)" -font $font_small
create_button_small .b_Lyn1 " SET " "update_constellations true Lynx"
create_button_small .b_Lyn0 "Unset" "update_constellations false Lynx"
pack .l_Lyn -in .fr_Lyn
pack .b_Lyn0 .b_Lyn1 -side left -expand 1 -fill x -in .fr_Lyn

# とも座
frame .fr_Pup
label .l_Pup -text "$gui_tsl(CON_PUP)" -font $font_small
create_button_small .b_Pup1 " SET " "update_constellations true Puppis"
create_button_small .b_Pup0 "Unset" "update_constellations false Puppis"
pack .l_Pup -in .fr_Pup
pack .b_Pup0 .b_Pup1 -side left -expand 1 -fill x -in .fr_Pup

# りゅうこつ座
frame .fr_Car
label .l_Car -text "$gui_tsl(CON_CAR)" -font $font_small
create_button_small .b_Car1 " SET " "update_constellations true Carina"
create_button_small .b_Car0 "Unset" "update_constellations false Carina"
pack .l_Car -in .fr_Car
pack .b_Car0 .b_Car1 -side left -expand 1 -fill x -in .fr_Car

# アルゴ船座
frame .fr_Argo
label .l_Argo -text "$gui_tsl(CON_ARGO)" -font $font_small
create_button_small .b_Argo1 " SET " "update_constellations true Carina Puppis Vela Pyxis"
create_button_small .b_Argo0 "Unset" "update_constellations false Carina Puppis Vela Pyxis"
pack .l_Argo -in .fr_Argo
pack .b_Argo0 .b_Argo1 -side left -expand 1 -fill x -in .fr_Argo

pack .fr_Ori .fr_CMa .fr_CMi .fr_Gem .fr_Tau .fr_Aur .fr_cnst_lbl31 .fr_Mon .fr_Cam .fr_Lyn .fr_Argo -expand 0 -fill x -in .lf_winter
.pw add .lf_winter

################################################################

#
# See https://github.com/Stellarium/stellarium/blob/master/skycultures/modern/asterism_names.eng.fab
#

labelframe .lf_spring_asterism_star -text "Spring Asterism/Stars" -font $font_labelframe

# 北斗七星
frame .fr_001
label .l_001 -text "$gui_tsl(AST_BIG_DIPPER)"
create_button .b_0011 " SET " "update_asterisms true Big~Dipper~(Plough)"
create_button .b_0010 "Unset" "update_asterisms false Big~Dipper~(Plough)"
pack .l_001 -in .fr_001
pack .b_0010 .b_0011 -side left -expand 1 -fill x -in .fr_001

# 北斗七星5倍線
frame .fr_002
label .l_002 -text "$gui_tsl(AST_BIG_DIPPER_TO_POLARIS)"
create_button .b_0021 " SET " "update_asterisms true Big~Dipper~to~Polaris"
create_button .b_0020 "Unset" "update_asterisms false Big~Dipper~to~Polaris"
pack .l_002 -in .fr_002
pack .b_0020 .b_0021 -side left -expand 1 -fill x -in .fr_002

# 春の大三角
frame .fr_003
label .l_003 -text "$gui_tsl(AST_SPRING_TRIANGLE)"
create_button .b_0031 " SET " "update_asterisms true Spring~Triangle"
create_button .b_0030 "Unset" "update_asterisms false Spring~Triangle"
pack .l_003 -in .fr_003
pack .b_0030 .b_0031 -side left -expand 1 -fill x -in .fr_003

# 春の大曲線
frame .fr_004
label .l_004 -text "$gui_tsl(AST_SPRING_CURVE)"
create_button .b_0041 " SET " "update_asterisms true Spring~Curve"
create_button .b_0040 "Unset" "update_asterisms false Spring~Curve"
pack .l_004 -in .fr_004
pack .b_0040 .b_0041 -side left -expand 1 -fill x -in .fr_004

#

frame .fr_ast_lbl01

# 春のダイヤモンド
frame .fr_005
label .l_005 -text "$gui_tsl(AST_GREAT_DIAMOND)" -font $font_small
create_button_small .b_0051 "SET" "update_asterisms true Great~Diamond"
create_button_small .b_0050 "Unset" "update_asterisms false Great~Diamond"
pack .l_005 -in .fr_005
pack .b_0050 .b_0051 -side left -expand 1 -fill x -in .fr_005

# おとめ座のＬ
frame .fr_006
label .l_006 -text "$gui_tsl(AST_L_OF_VIRGO)" -font $font_small
create_button_small .b_0061 "SET" "update_asterisms true L~of~Virgo"
create_button_small .b_0060 "Unset" "update_asterisms false L~of~Virgo"
pack .l_006 -in .fr_006
pack .b_0060 .b_0061 -side left -expand 1 -fill x -in .fr_006

pack .fr_006 .fr_005 -side left -expand 1 -fill x -in .fr_ast_lbl01

#

# カシオペヤ座5倍線
frame .fr_007
label .l_007 -text "$gui_tsl(AST_CASSIOPEIA_TO_POLARIS)" -font $font_small
create_button_small .b_0071 " SET " "update_asterisms true Cassiopeia~to~Polaris"
create_button_small .b_0070 "Unset" "update_asterisms false Cassiopeia~to~Polaris"
pack .l_007 -in .fr_007
pack .b_0070 .b_0071 -side left -expand 1 -fill x -in .fr_007

#

frame .fr_astar_lbl00 -height $margin_before_new_block

# 名称個別

frame .fr_astar_lbl01

#label .l_astar_eachlbl02 -textvariable textvariable_meishokobetsu -font $font_small -foreground $label_inverted_foreground -background $label_inverted_background
label .l_astar_eachlbl02 -textvariable textvariable_meishokobetsu -font $font_small -background $label_new_block_background -foreground $label_new_block_foreground
create_button_small .b_astar_off02 "$gui_tsl(ALL_OFF)" "update_star_labels_by_group false spring"
create_button_small .b_astar_on02 "$gui_tsl(ALL_ON)"     "update_star_labels_by_group true spring"
pack .l_astar_eachlbl02 .b_astar_off02 .b_astar_on02 -side left -expand 1 -fill both -in .fr_astar_lbl01

#

frame .fr_astar_lbl02

# 北極星
frame .fr_021
label .l_021 -text "$gui_tsl(STAR_POLARIS)" -font $font_small
create_button_small .b_0211 "ON" "update_star_labels true Polaris"
create_button_small .b_0210 "Off" "update_star_labels false Polaris"
pack .l_021 -in .fr_021
pack .b_0210 .b_0211 -side left -expand 1 -fill x -in .fr_021

# ミザール,アルコル
frame .fr_022
label .l_022 -text "$gui_tsl(STAR_MIZAR)" -font $font_small
create_button_small .b_0221 "ON" "update_star_labels true Mizar"
create_button_small .b_0220 "Off" "update_star_labels false Mizar"
pack .l_022 -in .fr_022
pack .b_0220 .b_0221 -side left -expand 1 -fill x -in .fr_022

pack .fr_021 .fr_022 -side left -expand 1 -fill x -in .fr_astar_lbl02

#

frame .fr_astar_lbl03

# アークトゥルス
frame .fr_023
label .l_023 -text "$gui_tsl(STAR_ARCTURUS)" -font $font_small
create_button_small .b_0231 "ON" "update_star_labels true Arcturus"
create_button_small .b_0230 "Off" "update_star_labels false Arcturus"
pack .l_023 -in .fr_023
pack .b_0230 .b_0231 -side left -expand 1 -fill x -in .fr_023

pack .fr_023 -side left -expand 1 -fill x -in .fr_astar_lbl03

#

frame .fr_astar_lbl04

# スピカ
frame .fr_025
label .l_025 -text "$gui_tsl(STAR_SPICA)" -font $font_small
create_button_small .b_0251 "ON" "update_star_labels true Spica"
create_button_small .b_0250 "Off" "update_star_labels false Spica"
pack .l_025 -in .fr_025
pack .b_0250 .b_0251 -side left -expand 1 -fill x -in .fr_025

# レグルス
frame .fr_026
label .l_026 -text "$gui_tsl(STAR_REGULUS)" -font $font_small
create_button_small .b_0261 "ON" "update_star_labels true Regulus"
create_button_small .b_0260 "Off" "update_star_labels false Regulus"
pack .l_026 -in .fr_026
pack .b_0260 .b_0261 -side left -expand 1 -fill x -in .fr_026

pack .fr_025 .fr_026 -side left -expand 1 -fill x -in .fr_astar_lbl04

#

frame .fr_astar_lbl05

# デネボラ
frame .fr_027
label .l_027 -text "$gui_tsl(STAR_DENEBOLA)" -font $font_small
create_button_small .b_0271 "ON" "update_star_labels true Denebola"
create_button_small .b_0270 "Off" "update_star_labels false Denebola"
pack .l_027 -in .fr_027
pack .b_0270 .b_0271 -side left -expand 1 -fill x -in .fr_027

# コル・カロリ
frame .fr_028
label .l_028 -text "$gui_tsl(STAR_COR_CAROLI)" -font $font_small
create_button_small .b_0281 "ON" "update_star_labels true CorCaroli"
create_button_small .b_0280 "Off" "update_star_labels false CorCaroli"
pack .l_028 -in .fr_028
pack .b_0280 .b_0281 -side left -expand 1 -fill x -in .fr_028

pack .fr_027 .fr_028 -side left -expand 1 -fill x -in .fr_astar_lbl05

#

frame .fr_astar_lbl06

# リギル・ケンタウルス
frame .fr_029
label .l_029 -text "$gui_tsl(STAR_RIGIL_KENTAURUS)" -font $font_small
create_button_small .b_0291 "ON" "update_star_labels true RigilKentaurus"
create_button_small .b_0290 "Off" "update_star_labels false RigilKentaurus"
pack .l_029 -in .fr_029
pack .b_0290 .b_0291 -side left -expand 1 -fill x -in .fr_029

pack .fr_029 -side left -expand 1 -fill x -in .fr_astar_lbl06

#

frame .fr_astar_lbl07

# アクルックス
frame .fr_030
label .l_030 -text "$gui_tsl(STAR_ACRUX)" -font $font_small
create_button_small .b_0301 "ON" "update_star_labels true Acrux"
create_button_small .b_0300 "Off" "update_star_labels false Acrux"
pack .l_030 -in .fr_030
pack .b_0300 .b_0301 -side left -expand 1 -fill x -in .fr_030

pack .fr_030 -side left -expand 1 -fill x -in .fr_astar_lbl07

#

pack .fr_001 .fr_002 .fr_003 .fr_004 .fr_ast_lbl01 -expand 0 -fill x -in .lf_spring_asterism_star
pack .fr_007 -expand 0 -fill x -in .lf_spring_asterism_star
pack .fr_astar_lbl00 .fr_astar_lbl01 .fr_astar_lbl02 .fr_astar_lbl03 .fr_astar_lbl04 .fr_astar_lbl05 .fr_astar_lbl06 -expand 0 -fill x -in .lf_spring_asterism_star
#pack .fr_astar_lbl07 -expand 0 -fill x -in .lf_spring_asterism_star

.pw add .lf_spring_asterism_star

################################################################

#
# See https://github.com/Stellarium/stellarium/blob/master/skycultures/modern/asterism_names.eng.fab
#

labelframe .lf_summer_asterism_star -text "Summer Asterism/Stars" -font $font_labelframe


# 北斗七星
frame .fr_101
label .l_101 -text "$gui_tsl(AST_BIG_DIPPER)" -font $font_small
create_button_small .b_1011 " SET " "update_asterisms true Big~Dipper~(Plough)"
create_button_small .b_1010 "Unset" "update_asterisms false Big~Dipper~(Plough)"
pack .l_101 -in .fr_101
pack .b_1010 .b_1011 -side left -expand 1 -fill x -in .fr_101

# 北斗七星5倍線
frame .fr_102
label .l_102 -text "$gui_tsl(AST_BIG_DIPPER_TO_POLARIS)" -font $font_small
create_button_small .b_1021 " SET " "update_asterisms true Big~Dipper~to~Polaris"
create_button_small .b_1020 "Unset" "update_asterisms false Big~Dipper~to~Polaris"
pack .l_102 -in .fr_102
pack .b_1020 .b_1021 -side left -expand 1 -fill x -in .fr_102

# 夏の大三角
frame .fr_103
label .l_103 -text "$gui_tsl(AST_SUMMER_TRIANGLE)"
create_button .b_1031 " SET " "update_asterisms true Summer~Triangle"
create_button .b_1030 "Unset" "update_asterisms false Summer~Triangle"
pack .l_103 -in .fr_103
pack .b_1030 .b_1031 -side left -expand 1 -fill x -in .fr_103

# 北十字
frame .fr_104
label .l_104 -text "$gui_tsl(AST_NORTHERN_CROSS)"
create_button .b_1041 " SET " "update_asterisms true Northern~Cross"
create_button .b_1040 "Unset" "update_asterisms false Northern~Cross"
pack .l_104 -in .fr_104
pack .b_1040 .b_1041 -side left -expand 1 -fill x -in .fr_104

# ティーポット
frame .fr_105
label .l_105 -text "$gui_tsl(AST_TEAPOT)"
create_button .b_1051 " SET " "update_asterisms true Teapot"
create_button .b_1050 "Unset" "update_asterisms false Teapot"
pack .l_105 -in .fr_105
pack .b_1050 .b_1051 -side left -expand 1 -fill x -in .fr_105

# 南斗六星
frame .fr_106
label .l_106 -text "$gui_tsl(AST_MILK_DIPPER)"
create_button .b_1061 " SET " "update_asterisms true Milk~Dipper"
create_button .b_1060 "Unset" "update_asterisms false Milk~Dipper"
pack .l_106 -in .fr_106
pack .b_1060 .b_1061 -side left -expand 1 -fill x -in .fr_106

# カシオペヤ座5倍線
frame .fr_107
label .l_107 -text "$gui_tsl(AST_CASSIOPEIA_TO_POLARIS)" -font $font_small
create_button_small .b_1071 " SET " "update_asterisms true Cassiopeia~to~Polaris"
create_button_small .b_1070 "Unset" "update_asterisms false Cassiopeia~to~Polaris"
pack .l_107 -in .fr_107
pack .b_1070 .b_1071 -side left -expand 1 -fill x -in .fr_107

#

frame .fr_astar_lbl10 -height $margin_before_new_block

# 名称個別

frame .fr_astar_lbl11

label .l_astar_eachlbl12 -textvariable textvariable_meishokobetsu -font $font_small -background $label_new_block_background -foreground $label_new_block_foreground
create_button_small .b_astar_off12 "$gui_tsl(ALL_OFF)" "update_star_labels_by_group false summer"
create_button_small .b_astar_on12 "$gui_tsl(ALL_ON)"   "update_star_labels_by_group true summer"
pack .l_astar_eachlbl12 .b_astar_off12 .b_astar_on12 -side left -expand 1 -fill both -in .fr_astar_lbl11

#

frame .fr_astar_lbl12

# 北極星
frame .fr_121
label .l_121 -text "$gui_tsl(STAR_POLARIS)" -font $font_small
create_button_small .b_1211 "ON" "update_star_labels true Polaris"
create_button_small .b_1210 "Off" "update_star_labels false Polaris"
pack .l_121 -in .fr_121
pack .b_1210 .b_1211 -side left -expand 1 -fill x -in .fr_121

# アンタレス
frame .fr_122
label .l_122 -text "$gui_tsl(STAR_ANTARES)" -font $font_small
create_button_small .b_1221 "ON" "update_star_labels true Antares"
create_button_small .b_1220 "Off" "update_star_labels false Antares"
pack .l_122 -in .fr_122
pack .b_1220 .b_1221 -side left -expand 1 -fill x -in .fr_122

pack .fr_121 .fr_122 -side left -expand 1 -fill x -in .fr_astar_lbl12

#

frame .fr_astar_lbl13

# ベガ
frame .fr_123
label .l_123 -text "$gui_tsl(STAR_VEGA)" -font $font_small
create_button_small .b_1231 "ON" "update_star_labels true Vega"
create_button_small .b_1230 "Off" "update_star_labels false Vega"
pack .l_123 -in .fr_123
pack .b_1230 .b_1231 -side left -expand 1 -fill x -in .fr_123

# アルタイル
frame .fr_124
label .l_124 -text "$gui_tsl(STAR_ALTAIR)" -font $font_small
create_button_small .b_1241 "ON" "update_star_labels true Altair"
create_button_small .b_1240 "Off" "update_star_labels false Altair"
pack .l_124 -in .fr_124
pack .b_1240 .b_1241 -side left -expand 1 -fill x -in .fr_124

pack .fr_123 .fr_124 -side left -expand 1 -fill x -in .fr_astar_lbl13

#

frame .fr_astar_lbl14

# デネブ
frame .fr_125
label .l_125 -text "$gui_tsl(STAR_DENEB)" -font $font_small
create_button_small .b_1251 "ON" "update_star_labels true Deneb"
create_button_small .b_1250 "Off" "update_star_labels false Deneb"
pack .l_125 -in .fr_125
pack .b_1250 .b_1251 -side left -expand 1 -fill x -in .fr_125

# アルビレオ
frame .fr_126
label .l_126 -text "$gui_tsl(STAR_ALBIREO)" -font $font_small
create_button_small .b_1261 "ON" "update_star_labels true Albireo"
create_button_small .b_1260 "Off" "update_star_labels false Albireo"
pack .l_126 -in .fr_126
pack .b_1260 .b_1261 -side left -expand 1 -fill x -in .fr_126

pack .fr_125 .fr_126 -side left -expand 1 -fill x -in .fr_astar_lbl14

#

pack .fr_101 .fr_102 .fr_103 .fr_104 .fr_105 .fr_106 .fr_107 .fr_astar_lbl10 .fr_astar_lbl11 .fr_astar_lbl12 .fr_astar_lbl13 .fr_astar_lbl14 -expand 0 -fill x -in .lf_summer_asterism_star

.pw add .lf_summer_asterism_star

################################################################

#
# See https://github.com/Stellarium/stellarium/blob/master/skycultures/modern/asterism_names.eng.fab
#

labelframe .lf_autumn_asterism_star -text "Autumn Asterism/Stars" -font $font_labelframe

# 北斗七星
frame .fr_201
label .l_201 -text "$gui_tsl(AST_BIG_DIPPER)"
create_button .b_2011 " SET " "update_asterisms true Big~Dipper~(Plough)"
create_button .b_2010 "Unset" "update_asterisms false Big~Dipper~(Plough)"
pack .l_201 -in .fr_201
pack .b_2010 .b_2011 -side left -expand 1 -fill x -in .fr_201

# 北斗七星5倍線
frame .fr_202
label .l_202 -text "$gui_tsl(AST_BIG_DIPPER_TO_POLARIS)"
create_button .b_2021 " SET " "update_asterisms true Big~Dipper~to~Polaris"
create_button .b_2020 "Unset" "update_asterisms false Big~Dipper~to~Polaris"
pack .l_202 -in .fr_202
pack .b_2020 .b_2021 -side left -expand 1 -fill x -in .fr_202

# 秋の四辺形
frame .fr_203
label .l_203 -text "$gui_tsl(AST_GREAT_SQUARE_OF_PEG)"
create_button .b_2031 " SET " "update_asterisms true Great~Square~of~Pegasus"
create_button .b_2030 "Unset" "update_asterisms false Great~Square~of~Pegasus"
pack .l_203 -in .fr_203
pack .b_2030 .b_2031 -side left -expand 1 -fill x -in .fr_203

# 四辺形から北極星
frame .fr_204
label .l_204 -text "$gui_tsl(AST_GREAT_SQUARE_TO_POLARIS)"
create_button .b_2041 " SET " "update_asterisms true Great~Square~to~Polaris"
create_button .b_2040 "Unset" "update_asterisms false Great~Square~to~Polaris"
pack .l_204 -in .fr_204
pack .b_2040 .b_2041 -side left -expand 1 -fill x -in .fr_204

# メドゥーサの首
frame .fr_205
label .l_205 -text "$gui_tsl(AST_HEAD_OF_MEDUSA)" -font $font_small
create_button_small .b_2051 " SET " "update_asterisms true Head~of~Medusa~Gorgon"
create_button_small .b_2050 "Unset" "update_asterisms false Head~of~Medusa~Gorgon"
pack .l_205 -in .fr_205
pack .b_2050 .b_2051 -side left -expand 1 -fill x -in .fr_205

# カシオペヤ座5倍線
frame .fr_206
label .l_206 -text "$gui_tsl(AST_CASSIOPEIA_TO_POLARIS)"
create_button .b_2061 " SET " "update_asterisms true Cassiopeia~to~Polaris"
create_button .b_2060 "Unset" "update_asterisms false Cassiopeia~to~Polaris"
pack .l_206 -in .fr_206
pack .b_2060 .b_2061 -side left -expand 1 -fill x -in .fr_206

#

frame .fr_astar_lbl20 -height $margin_before_new_block

#

frame .fr_astar_lbl21

label .l_astar_eachlbl22 -textvariable textvariable_meishokobetsu -font $font_small -background $label_new_block_background -foreground $label_new_block_foreground
create_button_small .b_astar_off22 "$gui_tsl(ALL_OFF)" "update_star_labels_by_group false autumn"
create_button_small .b_astar_on22 "$gui_tsl(ALL_ON)"   "update_star_labels_by_group true autumn"
pack .l_astar_eachlbl22 .b_astar_off22 .b_astar_on22 -side left -expand 1 -fill both -in .fr_astar_lbl21

# 名称個別

frame .fr_astar_lbl22

# 北極星
frame .fr_221
label .l_221 -text "$gui_tsl(STAR_POLARIS)" -font $font_small
create_button_small .b_2211 "ON" "update_star_labels true Polaris"
create_button_small .b_2210 "Off" "update_star_labels false Polaris"
pack .l_221 -in .fr_221
pack .b_2210 .b_2211 -side left -expand 1 -fill x -in .fr_221

# ミラ
frame .fr_222
label .l_222 -text "$gui_tsl(STAR_MIRA)" -font $font_small
create_button_small .b_2221 "ON" "update_star_labels true Mira"
create_button_small .b_2220 "Off" "update_star_labels false Mira"
pack .l_222 -in .fr_222
pack .b_2220 .b_2221 -side left -expand 1 -fill x -in .fr_222

pack .fr_221 .fr_222 -side left -expand 1 -fill x -in .fr_astar_lbl22

#

# フォーマルハウト
frame .fr_astar_lbl23
label .l_223 -text "$gui_tsl(STAR_FOMALHAUT)" -font $font_small
create_button_small .b_2231 "ON" "update_star_labels true Fomalhaut"
create_button_small .b_2230 "Off" "update_star_labels false Fomalhaut"
pack .l_223 -in .fr_astar_lbl23
pack .b_2230 .b_2231 -side left -expand 1 -fill x -in .fr_astar_lbl23

# デネブ・カイトス
frame .fr_astar_lbl24
label .l_224 -text "$gui_tsl(STAR_DIPHDA)" -font $font_small
create_button_small .b_2241 "ON" "update_star_labels true Diphda"
create_button_small .b_2240 "Off" "update_star_labels false Diphda"
pack .l_224 -in .fr_astar_lbl24
pack .b_2240 .b_2241 -side left -expand 1 -fill x -in .fr_astar_lbl24

# アルフェラッツ
frame .fr_astar_lbl25
label .l_225 -text "$gui_tsl(STAR_ALPHERATZ)" -font $font_small
create_button_small .b_2251 "ON" "update_star_labels true Alpheratz"
create_button_small .b_2250 "Off" "update_star_labels false Alpheratz"
pack .l_225 -in .fr_astar_lbl25
pack .b_2250 .b_2251 -side left -expand 1 -fill x -in .fr_astar_lbl25

pack .fr_201 .fr_202 .fr_203 .fr_204 .fr_205 .fr_206 .fr_astar_lbl20 .fr_astar_lbl21 .fr_astar_lbl22 .fr_astar_lbl23 .fr_astar_lbl24 .fr_astar_lbl25 -expand 0 -fill x -in .lf_autumn_asterism_star

.pw add .lf_autumn_asterism_star

################################################################

#
# See https://github.com/Stellarium/stellarium/blob/master/skycultures/modern/asterism_names.eng.fab
#

labelframe .lf_winter_asterism_star -text "Winter Asterism/Stars" -font $font_labelframe

# 北斗七星
frame .fr_301
label .l_301 -text "$gui_tsl(AST_BIG_DIPPER)"
create_button .b_3011 " SET " "update_asterisms true Big~Dipper~(Plough)"
create_button .b_3010 "Unset" "update_asterisms false Big~Dipper~(Plough)"
pack .l_301 -in .fr_301
pack .b_3010 .b_3011 -side left -expand 1 -fill x -in .fr_301

# 北斗七星5倍線
frame .fr_302
label .l_302 -text "$gui_tsl(AST_BIG_DIPPER_TO_POLARIS)"
create_button .b_3021 " SET " "update_asterisms true Big~Dipper~to~Polaris"
create_button .b_3020 "Unset" "update_asterisms false Big~Dipper~to~Polaris"
pack .l_302 -in .fr_302
pack .b_3020 .b_3021 -side left -expand 1 -fill x -in .fr_302

# 冬の大三角
frame .fr_303
label .l_303 -text "$gui_tsl(AST_WINTER_TRIANGLE)"
create_button .b_3031 " SET " "update_asterisms true Winter~Triangle"
create_button .b_3030 "Unset" "update_asterisms false Winter~Triangle"
pack .l_303 -in .fr_303
pack .b_3030 .b_3031 -side left -expand 1 -fill x -in .fr_303

# 冬のダイヤモンド
frame .fr_304
label .l_304 -text "$gui_tsl(AST_WINTER_HEXAGON)"
create_button .b_3041 " SET " "update_asterisms true Winter~Hexagon~(Winter~Circle)"
create_button .b_3040 "Unset" "update_asterisms false Winter~Hexagon~(Winter~Circle)"
pack .l_304 -in .fr_304
pack .b_3040 .b_3041 -side left -expand 1 -fill x -in .fr_304

# カシオペヤ座5倍線
frame .fr_307
label .l_307 -text "$gui_tsl(AST_CASSIOPEIA_TO_POLARIS)"
create_button_small .b_3071 " SET " "update_asterisms true Cassiopeia~to~Polaris"
create_button_small .b_3070 "Unset" "update_asterisms false Cassiopeia~to~Polaris"
pack .l_307 -in .fr_307
pack .b_3070 .b_3071 -side left -expand 1 -fill x -in .fr_307

#

frame .fr_astar_lbl30 -height $margin_before_new_block

#

frame .fr_astar_lbl31

label .l_astar_eachlbl32 -textvariable textvariable_meishokobetsu -font $font_small -background $label_new_block_background -foreground $label_new_block_foreground
create_button_small .b_astar_off32 "$gui_tsl(ALL_OFF)" "update_star_labels_by_group false winter"
create_button_small .b_astar_on32 "$gui_tsl(ALL_ON)"   "update_star_labels_by_group true winter"
pack .l_astar_eachlbl32 .b_astar_off32 .b_astar_on32 -side left -expand 1 -fill both -in .fr_astar_lbl31

# 名称個別

frame .fr_astar_lbl32

# 北極星
frame .fr_321
label .l_321 -text "$gui_tsl(STAR_POLARIS)" -font $font_small
create_button_small .b_3211 "ON" "update_star_labels true Polaris"
create_button_small .b_3210 "Off" "update_star_labels false Polaris"
pack .l_321 -in .fr_321
pack .b_3210 .b_3211 -side left -expand 1 -fill x -in .fr_321

# すばる
frame .fr_322
label .l_322 -text "$gui_tsl(STAR_PLEIADES)" -font $font_small
create_button_small .b_3221 "ON" "update_star_labels true M45"
create_button_small .b_3220 "Off" "update_star_labels false M45"
pack .l_322 -in .fr_322
pack .b_3220 .b_3221 -side left -expand 1 -fill x -in .fr_322

pack .fr_321 .fr_322 -side left -expand 1 -fill x -in .fr_astar_lbl32

#

frame .fr_astar_lbl33

# ベテルギウス
frame .fr_323
label .l_323 -text "$gui_tsl(STAR_BETELGEUSE)" -font $font_small
create_button_small .b_3231 "ON" "update_star_labels true Betelgeuse"
create_button_small .b_3230 "Off" "update_star_labels false Betelgeuse"
pack .l_323 -in .fr_323
pack .b_3230 .b_3231 -side left -expand 1 -fill x -in .fr_323

# リゲル
frame .fr_324
label .l_324 -text "$gui_tsl(STAR_RIGEL)" -font $font_small
create_button_small .b_3241 "ON" "update_star_labels true Rigel"
create_button_small .b_3240 "Off" "update_star_labels false Rigel"
pack .l_324 -in .fr_324
pack .b_3240 .b_3241 -side left -expand 1 -fill x -in .fr_324

pack .fr_323 .fr_324 -side left -expand 1 -fill x -in .fr_astar_lbl33

#

frame .fr_astar_lbl34

# シリウス
frame .fr_325
label .l_325 -text "$gui_tsl(STAR_SIRIUS)" -font $font_small
create_button_small .b_3251 "ON" "update_star_labels true Sirius"
create_button_small .b_3250 "Off" "update_star_labels false Sirius"
pack .l_325 -in .fr_325
pack .b_3250 .b_3251 -side left -expand 1 -fill x -in .fr_325

# プロキオン
frame .fr_326
label .l_326 -text "$gui_tsl(STAR_PROCYON)" -font $font_small
create_button_small .b_3261 "ON" "update_star_labels true Procyon"
create_button_small .b_3260 "Off" "update_star_labels false Procyon"
pack .l_326 -in .fr_326
pack .b_3260 .b_3261 -side left -expand 1 -fill x -in .fr_326

pack .fr_325 .fr_326 -side left -expand 1 -fill x -in .fr_astar_lbl34

#

frame .fr_astar_lbl35

# ポルックス
frame .fr_327
label .l_327 -text "$gui_tsl(STAR_POLLUX)" -font $font_small
create_button_small .b_3271 "ON" "update_star_labels true Pollux"
create_button_small .b_3270 "Off" "update_star_labels false Pollux"
pack .l_327 -in .fr_327
pack .b_3270 .b_3271 -side left -expand 1 -fill x -in .fr_327

# カストル
frame .fr_328
label .l_328 -text "$gui_tsl(STAR_CASTOR)" -font $font_small
create_button_small .b_3281 "ON" "update_star_labels true Castor"
create_button_small .b_3280 "Off" "update_star_labels false Castor"
pack .l_328 -in .fr_328
pack .b_3280 .b_3281 -side left -expand 1 -fill x -in .fr_328

pack .fr_327 .fr_328 -side left -expand 1 -fill x -in .fr_astar_lbl35

#

frame .fr_astar_lbl36

# カペラ
frame .fr_329
label .l_329 -text "$gui_tsl(STAR_CAPELLA)" -font $font_small
create_button_small .b_3291 "ON" "update_star_labels true Capella"
create_button_small .b_3290 "Off" "update_star_labels false Capella"
pack .l_329 -in .fr_329
pack .b_3290 .b_3291 -side left -expand 1 -fill x -in .fr_329

# アルデバラン
frame .fr_330
label .l_330 -text "$gui_tsl(STAR_ALDEBARAN)" -font $font_small
create_button_small .b_3301 "ON" "update_star_labels true Aldebaran"
create_button_small .b_3300 "Off" "update_star_labels false Aldebaran"
pack .l_330 -in .fr_330
pack .b_3300 .b_3301 -side left -expand 1 -fill x -in .fr_330

pack .fr_329 .fr_330 -side left -expand 1 -fill x -in .fr_astar_lbl36

#

# カノープス
frame .fr_331
label .l_331 -text "$gui_tsl(STAR_CANOPUS)" -font $font_small
create_button_small .b_3311 "ON" "update_star_labels true Canopus"
create_button_small .b_3310 "Off" "update_star_labels false Canopus"
pack .l_331 -in .fr_331
pack .b_3310 .b_3311 -side left -expand 1 -fill x -in .fr_331

#

pack .fr_301 .fr_302 .fr_303 .fr_304 .fr_307 .fr_astar_lbl30 .fr_astar_lbl31 .fr_astar_lbl32 -expand 0 -fill x -in .lf_winter_asterism_star
pack .fr_astar_lbl33 .fr_astar_lbl34 .fr_astar_lbl35 .fr_astar_lbl36 .fr_331 -expand 0 -fill x -in .lf_winter_asterism_star

.pw add .lf_winter_asterism_star

################################################################

labelframe .lf_solarsystem -text "Solar System" -font $font_labelframe

frame .fr_sol_disp0
create_button_code .b_sol_reset "$gui_tsl(GROUP_RESET)" "reset_solarsystem"
label .l_sol_disp -text "$gui_tsl(SOLARSYSTEM_SHOW)"
pack .b_sol_reset -anchor n -pady [list 0 $pad_bottom_for_group_reset_button] -side left -in .fr_sol_disp0
pack .l_sol_disp  -anchor s -side left -expand 1 -fill x -in .fr_sol_disp0
frame .fr_sol_disp1
create_button .b_sol_disp0 "Off" "unset_solarsystem"
create_button .b_sol_disp1 "ON" "exec_ssc_on_server setSolarSystem.ssc updateLightMoonPollution.ssc"
pack .b_sol_disp0 .b_sol_disp1 -side left -expand 1 -fill x -in .fr_sol_disp1

frame .fr_sol_label
label .l_sol_label -text "$gui_tsl(SOLSYS_LABELS)"
create_button_small .b_sol_label0 "Unset" "send_ssc_of_solsyslabels -"
#entry .e_sol_label -font $font_small -width 4 -textvariable buffer_solsyslabels
ttk::entry .e_sol_label -font $font_small -width 4 -textvariable buffer_solsyslabels
set buffer_solsyslabels "0.0"
create_button_small .b_sol_label1 "$gui_tsl(ARR_LEFT)" "send_ssc_of_solsyslabels -0.5"
create_button_small .b_sol_label2 "$gui_tsl(ARR_RIGHT)" "send_ssc_of_solsyslabels +0.5"
bind .e_sol_label <Return> "send_ssc_of_solsyslabels"
pack .l_sol_label -in .fr_sol_label
pack .b_sol_label0 -side left -fill both -in .fr_sol_label
pack .e_sol_label -expand 1 -side left -fill both -in .fr_sol_label
pack .b_sol_label1 .b_sol_label2 -side left -fill both -in .fr_sol_label

if { 25 <= [get_stellarium_major_version] } {
  frame .fr_sol_porbit_margin -height $margin_for_high_density_gui
  frame .fr_sol_porbit0
  frame .fr_sol_porbit1
  label .l_sol_porbit -text "$gui_tsl(SOLSYS_ORBITS)"
  create_button_small .b_sol_porbit0 "Unset" "exec_ssc_on_server unsetEarthOrbitLabels.ssc unsetEarthOrbit.ssc initPlanetaryOrbits.ssc"
  create_button_small .b_sol_porbit  "$gui_tsl(ALL_S)" "exec_ssc_on_server initPlanetaryOrbits.ssc setMercuryOrbit.ssc setVenusOrbit.ssc setEarthOrbit.ssc setMarsOrbit.ssc setJupiterOrbit.ssc setSaturnOrbit.ssc setUranusOrbit.ssc setNeptuneOrbit.ssc setMoonsOrbits.ssc"
  create_button_small .b_sol_porbit1 "$gui_tsl(PLANETS_S)" "exec_ssc_on_server initPlanetaryOrbits.ssc setMercuryOrbit.ssc setVenusOrbit.ssc setEarthOrbit.ssc setMarsOrbit.ssc setJupiterOrbit.ssc setSaturnOrbit.ssc setUranusOrbit.ssc setNeptuneOrbit.ssc"
  create_button_small .b_sol_porbit2 "$gui_tsl(MERCURY_S)" "exec_ssc_on_server setMercuryOrbit.ssc"
  create_button_small .b_sol_porbit3 "$gui_tsl(VENUS_S)" "exec_ssc_on_server setVenusOrbit.ssc"
  create_button_small .b_sol_porbit4 "$gui_tsl(MARS_S)" "exec_ssc_on_server setMarsOrbit.ssc"
  create_button_small .b_sol_porbit5 "$gui_tsl(JUPITER_S)" "exec_ssc_on_server setJupiterOrbit.ssc"
  create_button_small .b_sol_porbit6 "$gui_tsl(SATURN_S)" "exec_ssc_on_server setSaturnOrbit.ssc"
  create_button_small .b_sol_porbit7 "$gui_tsl(URANUS_S)" "exec_ssc_on_server setUranusOrbit.ssc"
  create_button_small .b_sol_porbit8 "$gui_tsl(NEPTUNE_S)" "exec_ssc_on_server setNeptuneOrbit.ssc"
  create_button_small .b_sol_porbit9 "$gui_tsl(MOON_S)" "exec_ssc_on_server setMoonsOrbits.ssc"
  pack .l_sol_porbit -side left -expand 1 -fill x -in .fr_sol_porbit0
  pack .b_sol_porbit0 .b_sol_porbit  .b_sol_porbit1 .b_sol_porbit9 -side left -fill y -in .fr_sol_porbit0
  pack .b_sol_porbit2 .b_sol_porbit3 .b_sol_porbit4 -side left -expand 1 -fill x -in .fr_sol_porbit1
  pack .b_sol_porbit5 .b_sol_porbit6 .b_sol_porbit7 .b_sol_porbit8 -side left -expand 1 -fill x -in .fr_sol_porbit1
} else {
  frame .fr_sol_porbit
  label .l_sol_porbit -text "$gui_tsl(SOLSYS_ORBITS)"
  create_button .b_sol_porbit0 "Unset" "send_ssc_lines SolarSystem.setFlagOrbits(false)"
  create_button .b_sol_porbit1 "SET" "send_or_exec_ssc SolarSystem.setOrbitColorStyle('one_color') setPlanetaryOrbits.ssc"
  create_button .b_sol_porbit2 "$gui_tsl(COLOR_S)" "send_or_exec_ssc setPlanetaryOrbits.ssc SolarSystem.setOrbitColorStyle('major_planets_minor_types')"
  create_button .b_sol_porbit3 "$gui_tsl(MOON_S)" "send_or_exec_ssc SolarSystem.setOrbitColorStyle('major_planets_minor_types') setMoonPlanetaryOrbits.ssc"
  pack .l_sol_porbit -in .fr_sol_porbit
  pack .b_sol_porbit0 .b_sol_porbit1 .b_sol_porbit2 .b_sol_porbit3 -side left -expand 1 -fill x -in .fr_sol_porbit
}

frame .fr_sol_eorbit
label .l_sol_eorbit -text "$gui_tsl(SOLSYS_EARTH_ORBIT)"
create_button_small .b_sol_eorbit0 "Unset" "exec_ssc_on_server unsetEarthOrbitLabels.ssc unsetEarthOrbit.ssc"
create_button_small .b_sol_eorbit1 "SET" "exec_ssc_on_server unsetEarthOrbitLabels.ssc setEarthOrbit.ssc"
create_button_small .b_sol_eorbit2 "DATE" "exec_ssc_on_server setEarthOrbit.ssc setEarthOrbitLabels.ssc"
pack .l_sol_eorbit -in .fr_sol_eorbit
pack .b_sol_eorbit0 .b_sol_eorbit1 .b_sol_eorbit2 -side left -expand 1 -fill x -in .fr_sol_eorbit

frame .fr_sol_pscale
label .l_sol_pscale -text "$gui_tsl(SOLSYS_OBJ_SCALE)"
create_button_small .b_sol_pscale0 "$gui_tsl(SOLSYS_PLANET_1X)" "send_ssc_of_solpscale -"
create_button_small .b_sol_pscale1 "400x" "send_ssc_of_solpscale 400"
#entry .e_sol_pscale -font $font_small -width 4 -textvariable buffer_solpscale
ttk::entry .e_sol_pscale -font $font_small -width 4 -textvariable buffer_solpscale
set buffer_solpscale "1"
create_button_small .b_sol_pscale3 "$gui_tsl(ARR_LEFT)" "send_ssc_of_solpscale +0.5"
create_button_small .b_sol_pscale4 "$gui_tsl(ARR_RIGHT)" "send_ssc_of_solpscale +2.0"
bind .e_sol_pscale <Return> "send_ssc_of_solpscale"
pack .l_sol_pscale -in .fr_sol_pscale
pack .b_sol_pscale0 .b_sol_pscale1 -side left -fill both -in .fr_sol_pscale
pack .e_sol_pscale -side left -expand 1 -fill both -in .fr_sol_pscale
pack .b_sol_pscale3 .b_sol_pscale4 -side left -fill both -in .fr_sol_pscale

frame .fr_sol_mscale
#label .l_sol_mscale -text "月 表示サイズ" -font $font_small
create_button_small .b_sol_mscale0 "$gui_tsl(SOLSYS_MOON_1X)" "send_ssc_of_solmscale %"
create_button_small .b_sol_mscale1 "$gui_tsl(INIT_M)" "send_ssc_of_solmscale -"
#entry .e_sol_mscale -font $font_small -width 3 -textvariable buffer_solmscale
ttk::entry .e_sol_mscale -font $font_small -width 3 -textvariable buffer_solmscale
set buffer_solmscale "4"
create_button_small .b_sol_mscale3 "$gui_tsl(ARR_LEFT)" "send_ssc_of_solmscale +0.5"
create_button_small .b_sol_mscale4 "$gui_tsl(ARR_RIGHT)" "send_ssc_of_solmscale +2.0"
bind .e_sol_mscale <Return> "send_ssc_of_solmscale"
#pack .l_sol_mscale -in .fr_sol_mscale
pack .b_sol_mscale0 .b_sol_mscale1 -side left -fill both -in .fr_sol_mscale
pack .e_sol_mscale -side left -expand 1 -fill both -in .fr_sol_mscale
pack .b_sol_mscale3 .b_sol_mscale4 -side left -fill both -in .fr_sol_mscale

frame .fr_sol_sscale
#label .l_sol_sscale -text "太陽 表示サイズ" -font $font_small
create_button_small .b_sol_sscale0 "$gui_tsl(SOLSYS_SUN_1X)" "send_ssc_of_solsscale %"
create_button_small .b_sol_sscale1 "$gui_tsl(INIT_M)" "send_ssc_of_solsscale -"
#entry .e_sol_sscale -font $font_small -width 3 -textvariable buffer_solsscale
ttk::entry .e_sol_sscale -font $font_small -width 3 -textvariable buffer_solsscale
set buffer_solsscale "4"
create_button_small .b_sol_sscale3 "$gui_tsl(ARR_LEFT)" "send_ssc_of_solsscale +0.5"
create_button_small .b_sol_sscale4 "$gui_tsl(ARR_RIGHT)" "send_ssc_of_solsscale +2.0"
bind .e_sol_sscale <Return> "send_ssc_of_solsscale"
#pack .l_sol_sscale -in .fr_sol_sscale
pack .b_sol_sscale0 .b_sol_sscale1 -side left -fill both -in .fr_sol_sscale
pack .e_sol_sscale -side left -expand 1 -fill both -in .fr_sol_sscale
pack .b_sol_sscale3 .b_sol_sscale4 -side left -fill both -in .fr_sol_sscale

#

frame .fr_sol_margin -height $margin_before_new_block

frame .fr_sol_lbl00

label .l_sol_eachlabel -textvariable textvariable_meishokobetsu -font $font_small -background $label_new_block_background -foreground $label_new_block_foreground
create_button_small .b_sol_label00A_0 "$gui_tsl(ALL_OFF)" "update_star_labels_by_group false solarsystem"
create_button_small .b_sol_label00A_1 "$gui_tsl(ALL_ON)" "update_star_labels_by_group true solarsystem"
pack .l_sol_eachlabel .b_sol_label00A_0 .b_sol_label00A_1 -side left -expand 1 -fill both -in .fr_sol_lbl00

#

frame .fr_sol_lbl01

frame .fr_sol_label000
label .l_sol_label000 -text "$gui_tsl(SUN)" -font $font_small
create_button_small .b_sol_label000_1 "ON" "update_star_labels true Sun"
create_button_small .b_sol_label000_0 "Off" "update_star_labels false Sun"
pack .l_sol_label000 -in .fr_sol_label000
pack .b_sol_label000_0 .b_sol_label000_1 -side left -expand 1 -fill x -in .fr_sol_label000

frame .fr_sol_label001
label .l_sol_label001 -text "$gui_tsl(MOON)" -font $font_small
create_button_small .b_sol_label001_1 "ON" "update_star_labels true Moon"
create_button_small .b_sol_label001_0 "Off" "update_star_labels false Moon"
pack .l_sol_label001 -in .fr_sol_label001
pack .b_sol_label001_0 .b_sol_label001_1 -side left -expand 1 -fill x -in .fr_sol_label001

pack .fr_sol_label000 .fr_sol_label001 -side left -expand 1 -fill x -in .fr_sol_lbl01

#

frame .fr_sol_lbl02

frame .fr_sol_label002
label .l_sol_label002 -text "$gui_tsl(MERCURY)" -font $font_small
create_button_small .b_sol_label002_1 "ON" "update_star_labels true Mercury"
create_button_small .b_sol_label002_0 "Off" "update_star_labels false Mercury"
pack .l_sol_label002 -in .fr_sol_label002
pack .b_sol_label002_0 .b_sol_label002_1 -side left -expand 1 -fill x -in .fr_sol_label002

frame .fr_sol_label003
label .l_sol_label003 -text "$gui_tsl(VENUS)" -font $font_small
create_button_small .b_sol_label003_1 "ON" "update_star_labels true Venus"
create_button_small .b_sol_label003_0 "Off" "update_star_labels false Venus"
pack .l_sol_label003 -in .fr_sol_label003
pack .b_sol_label003_0 .b_sol_label003_1 -side left -expand 1 -fill x -in .fr_sol_label003

pack .fr_sol_label002 .fr_sol_label003 -side left -expand 1 -fill x -in .fr_sol_lbl02

#

frame .fr_sol_lbl03

frame .fr_sol_label004
label .l_sol_label004 -text "$gui_tsl(EARTH)" -font $font_small
create_button_small .b_sol_label004_1 "ON" "update_star_labels true Earth"
create_button_small .b_sol_label004_0 "Off" "update_star_labels false Earth"
pack .l_sol_label004 -in .fr_sol_label004
pack .b_sol_label004_0 .b_sol_label004_1 -side left -expand 1 -fill x -in .fr_sol_label004

frame .fr_sol_label005
label .l_sol_label005 -text "$gui_tsl(MARS)" -font $font_small
create_button_small .b_sol_label005_1 "ON" "update_star_labels true Mars"
create_button_small .b_sol_label005_0 "Off" "update_star_labels false Mars"
pack .l_sol_label005 -in .fr_sol_label005
pack .b_sol_label005_0 .b_sol_label005_1 -side left -expand 1 -fill x -in .fr_sol_label005

pack .fr_sol_label004 .fr_sol_label005 -side left -expand 1 -fill x -in .fr_sol_lbl03

#

frame .fr_sol_lbl04

frame .fr_sol_label006
label .l_sol_label006 -text "$gui_tsl(JUPITER)" -font $font_small
create_button_small .b_sol_label006_1 "ON" "update_star_labels true Jupiter"
create_button_small .b_sol_label006_0 "Off" "update_star_labels false Jupiter"
pack .l_sol_label006 -in .fr_sol_label006
pack .b_sol_label006_0 .b_sol_label006_1 -side left -expand 1 -fill x -in .fr_sol_label006

frame .fr_sol_label007
label .l_sol_label007 -text "$gui_tsl(SATURN)" -font $font_small
create_button_small .b_sol_label007_1 "ON" "update_star_labels true Saturn"
create_button_small .b_sol_label007_0 "Off" "update_star_labels false Saturn"
pack .l_sol_label007 -in .fr_sol_label007
pack .b_sol_label007_0 .b_sol_label007_1 -side left -expand 1 -fill x -in .fr_sol_label007

pack .fr_sol_label006 .fr_sol_label007 -side left -expand 1 -fill x -in .fr_sol_lbl04

#

frame .fr_sol_lbl05

frame .fr_sol_label008
label .l_sol_label008 -text "$gui_tsl(URANUS)" -font $font_small
create_button_small .b_sol_label008_1 "ON" "update_star_labels true Uranus"
create_button_small .b_sol_label008_0 "Off" "update_star_labels false Uranus"
pack .l_sol_label008 -in .fr_sol_label008
pack .b_sol_label008_0 .b_sol_label008_1 -side left -expand 1 -fill x -in .fr_sol_label008

frame .fr_sol_label009
label .l_sol_label009 -text "$gui_tsl(NEPTUNE)" -font $font_small
create_button_small .b_sol_label009_1 "ON" "update_star_labels true Neptune"
create_button_small .b_sol_label009_0 "Off" "update_star_labels false Neptune"
pack .l_sol_label009 -in .fr_sol_label009
pack .b_sol_label009_0 .b_sol_label009_1 -side left -expand 1 -fill x -in .fr_sol_label009

pack .fr_sol_label008 .fr_sol_label009 -side left -expand 1 -fill x -in .fr_sol_lbl05

#

pack .fr_sol_disp0 .fr_sol_disp1 .fr_sol_label -expand 0 -fill x -in .lf_solarsystem

if { 25 <= [get_stellarium_major_version] } {
  pack .fr_sol_porbit_margin .fr_sol_porbit0 .fr_sol_porbit1 -expand 0 -fill x -in .lf_solarsystem
} else {
  pack .fr_sol_porbit -expand 0 -fill x -in .lf_solarsystem
}

pack .fr_sol_eorbit .fr_sol_pscale .fr_sol_mscale .fr_sol_sscale -expand 0 -fill x -in .lf_solarsystem

pack .fr_sol_margin .fr_sol_lbl00 .fr_sol_lbl01 .fr_sol_lbl02 .fr_sol_lbl03 .fr_sol_lbl04 .fr_sol_lbl05 -expand 0 -fill x -in .lf_solarsystem

.pw add .lf_solarsystem


################################################################

labelframe .lf_dso_p0 -text "Objects" -font $font_labelframe

frame .fr_nebula
label .l_dso_list -text "$gui_tsl(DSO_LIST)" -background $label_new_block_background -foreground $label_new_block_foreground
label .l_nebula -text "$gui_tsl(DSO_HINTS_SHOW)" -font $font_small
create_button_small .b_nebula1 "ON" "send_ssc_lines NebulaMgr.setFlagHints(true) NebulaMgr.setFlagShow(true)"
create_button_small .b_nebula0 "Off" "send_ssc_lines NebulaMgr.setFlagHints(false) NebulaMgr.setFlagShow(false)"
pack .l_dso_list .l_nebula -fill x -in .fr_nebula
pack .b_nebula0 .b_nebula1 -side left -expand 1 -fill x -in .fr_nebula

frame .fr_dsotype
label .l_dsotype -text "$gui_tsl(DSO_CAT_SELECTION)" -font $font_small
create_button_small .b_dsotype1 "NGC" "send_ssc_lines NebulaMgr.setCatalogFilters(1)"
create_button_small .b_dsotype2 "IC" "send_ssc_lines NebulaMgr.setCatalogFilters(2)"
create_button_small .b_dsotype4 " M " "send_ssc_lines NebulaMgr.setCatalogFilters(4)"
pack .l_dsotype -in .fr_dsotype
pack .b_dsotype4 .b_dsotype1 .b_dsotype2 -side left -expand 1 -fill x -in .fr_dsotype

frame .fr_dsolblhint

frame .fr_dsohint
label .l_dsohint -text "$gui_tsl(DSO_CAT_HINTS)" -font $font_small
create_button_small .b_dsohint0 "0,3" "send_ssc_of_dsohints -"
#entry .e_dsohint -font $font_small -width 5 -textvariable buffer_dsohints
ttk::entry .e_dsohint -font $font_small -width 5 -textvariable buffer_dsohints
set buffer_dsohints "0.0"
create_button_small .b_dsohint1 "$gui_tsl(ARR_LEFT)" "send_ssc_of_dsohints -0.5"
create_button_small .b_dsohint2 "$gui_tsl(ARR_RIGHT)" "send_ssc_of_dsohints +0.5"
bind .e_dsohint <Return> "send_ssc_of_dsohints"
pack .l_dsohint -in .fr_dsohint
pack .b_dsohint0 -side left -fill both -in .fr_dsohint
pack .e_dsohint -expand 1 -side left -fill both -in .fr_dsohint
pack .b_dsohint1 .b_dsohint2 -side left -fill both -in .fr_dsohint

frame .fr_dsolbl
label .l_dsolbl -text "$gui_tsl(DSO_CAT_LABELS)" -font $font_small
create_button_small .b_dsolbl0 "0,3" "send_ssc_of_dsolabels -"
#entry .e_dsolbl -font $font_small -width 5 -textvariable buffer_dsolabels
ttk::entry .e_dsolbl -font $font_small -width 5 -textvariable buffer_dsolabels
set buffer_dsolabels "0.0"
create_button_small .b_dsolbl1 "$gui_tsl(ARR_LEFT)" "send_ssc_of_dsolabels -0.5"
create_button_small .b_dsolbl2 "$gui_tsl(ARR_RIGHT)" "send_ssc_of_dsolabels +0.5"
bind .e_dsolbl <Return> "send_ssc_of_dsolabels"
pack .l_dsolbl -in .fr_dsolbl
pack .b_dsolbl0 -side left -fill both -in .fr_dsolbl
pack .e_dsolbl -expand 1 -side left -fill both -in .fr_dsolbl
pack .b_dsolbl1 .b_dsolbl2 -side left -fill both -in .fr_dsolbl

# GUIのスペースが厳しくなったら以下に -side left をつけて ヒント・名称 を横並びにする
pack .fr_dsohint .fr_dsolbl -fill x -expand 1 -in .fr_dsolblhint

frame .fr_dsoeach_margin -height $margin_before_new_block

frame .fr_dsoinit_p0
label .l_dso_each -text "$gui_tsl(OBJ_INDIVIDUAL)" -background $label_new_block_background -foreground $label_new_block_foreground
frame .fr_lbl_dsoinit_p0
label .l_dsoinit_p00 -text "$gui_tsl(OBJ_IND_PHOTO0)" -font $font_small
label .l_dsoinit_p01 -text "$gui_tsl(OBJ_IND_PHOTO1)" -font $font_small
label .l_dsoinit_p02 -text "$gui_tsl(OBJ_IND_PHOTO2)" -font $font_small
pack .l_dsoinit_p00 .l_dsoinit_p01 .l_dsoinit_p02 -side left -in .fr_lbl_dsoinit_p0
create_button_small .b_dsoinit_p0off "Off" "exec_ssc_on_server unsetDSOImages.ssc"
create_button_small .b_dsoinit_p0on  "ON"  "exec_ssc_on_server setDSOImages.ssc"
pack .l_dso_each -fill x -in .fr_dsoinit_p0
pack .fr_lbl_dsoinit_p0 -in .fr_dsoinit_p0
pack .b_dsoinit_p0off .b_dsoinit_p0on -side left -expand 1 -fill x -in .fr_dsoinit_p0

frame .fr_dsoinit_p1
label .l_dsoinit_p1 -text "$gui_tsl(OBJ_IND_RESET)"
pack .l_dsoinit_p1 -fill x -in .fr_dsoinit_p1
if { $flag_dome_mode != 0 } {
  create_button .b_dsoinit_p1m "$gui_tsl(OBJ_IND_MARKER)" "send_ssc_lines core.setSelectedObjectMarkerVisible(false)"
  pack .b_dsoinit_p1m -side left -expand 1 -fill x -in .fr_dsoinit_p1
}
create_button .b_dsoinit_p1v "$gui_tsl(OBJ_IND_VIEW)" "reset_dso_zoom_on_server"
pack .b_dsoinit_p1v -side left -expand 1 -fill x -in .fr_dsoinit_p1

frame .fr_dsomarker
label .l_dsomarker -text "$gui_tsl(OBJ_IND_SELECT)"
#entry .e_dsomarker -width 8 -textvariable buffer_selected_dsoname
ttk::entry .e_dsomarker -width 8 -textvariable buffer_selected_dsoname
bind .e_dsomarker <Return> "select_a_dso"
create_button .b_dsomarker "SET" "select_a_dso"
pack .l_dsomarker -in .fr_dsomarker
pack .e_dsomarker .b_dsomarker -side left -expand 1 -fill both -in .fr_dsomarker

frame .fr_dsozoom
label .l_dsozoom -text "$gui_tsl(OBJ_IND_ZOOM)"
frame .fr_dsozoom_b0
create_button .b_dsozoom32 "32" "perform_dso_zoom_on_server moveZoomToSelectedFov32.ssc"
create_button .b_dsozoom16 "16" "perform_dso_zoom_on_server moveZoomToSelectedFov16.ssc"
create_button .b_dsozoom8 "8" "perform_dso_zoom_on_server moveZoomToSelectedFov8.ssc"
create_button .b_dsozoom4 "4" "perform_dso_zoom_on_server moveZoomToSelectedFov4.ssc"
create_button .b_dsozoom2 "2" "perform_dso_zoom_on_server moveZoomToSelectedFov2.ssc"
create_button .b_dsozoom1 "1" "perform_dso_zoom_on_server moveZoomToSelectedFov1.ssc"
pack .b_dsozoom32 .b_dsozoom16 .b_dsozoom8 .b_dsozoom4 .b_dsozoom2 .b_dsozoom1 -side left -expand 1 -fill x -in .fr_dsozoom_b0
frame .fr_dsozoom_b1
create_button_small .b_dsozoom18m "0.3" "perform_dso_zoom_on_server moveZoomToSelectedFov0.3.ssc"
create_button_small .b_dsozoom6m "0.1" "perform_dso_zoom_on_server moveZoomToSelectedFov0.1.ssc"
create_button_small .b_dsozoom2m "0.03" "perform_dso_zoom_on_server moveZoomToSelectedFov0.03.ssc"
create_button_small .b_dsozoom06m "0.01" "perform_dso_zoom_on_server moveZoomToSelectedFov0.01.ssc"
pack .b_dsozoom18m .b_dsozoom6m .b_dsozoom2m .b_dsozoom06m -side left -expand 1 -fill x -in .fr_dsozoom_b1
pack .l_dsozoom -in .fr_dsozoom
pack .fr_dsozoom_b0 .fr_dsozoom_b1 -expand 1 -fill x -in .fr_dsozoom

set buffer_dso_fov_circular_size "1.0000"
frame .fr_dsofovc

frame .fr_dsofovc_margin -height $margin_for_high_density_gui

frame .fr_dsofovc_b0
label .l_dsofovc -text "$gui_tsl(OBJ_IND_FOVC)"
create_button_small .b_dso_ed_fovc "$gui_tsl(EDIT)" "open_text_editor .edt_fov list_fov-circular.txt"
pack .l_dsofovc -expand 1 -side left -fill both -in .fr_dsofovc_b0
pack .b_dso_ed_fovc -side left -fill both -in .fr_dsofovc_b0

frame .fr_dsofovc_b1
create_button .b_dsofovc0 "Off" "send_ssc_lines SpecialMarkersMgr.setFlagFOVCircularMarker(false)"
#entry .e_dsofovc -width 6 -textvariable buffer_dso_fov_circular_size
ttk::entry .e_dsofovc -width 6 -textvariable buffer_dso_fov_circular_size
create_button .b_dsofovc1 "ON" "send_ssc_of_dso_fov_circular_marker"
bind .e_dsofovc <Return> "send_ssc_of_dso_fov_circular_marker"
pack .b_dsofovc0 -side left -fill both -in .fr_dsofovc_b1
pack .e_dsofovc -expand 1 -side left -fill both -in .fr_dsofovc_b1
pack .b_dsofovc1 -side left -fill both -in .fr_dsofovc_b1

#frame .fr_dsofovc_b2
#create_button_small .b_dsofovc_t0 "6x" "send_ssc_of_dso_fov_circular_marker 8.0"
#create_button_small .b_dsofovc_t1 "45x" "send_ssc_of_dso_fov_circular_marker 1.0"
#create_button_small .b_dsofovc_t2 "100x" "send_ssc_of_dso_fov_circular_marker 0.45"
#create_button_small .b_dsofovc_t3 "200x" "send_ssc_of_dso_fov_circular_marker 0.225"
#pack .b_dsofovc_t0 .b_dsofovc_t1 .b_dsofovc_t2 .b_dsofovc_t3 -expand 1 -side left -fill x -in .fr_dsofovc_b2

pack .fr_dsofovc_b0 .fr_dsofovc_b1 -expand 1 -fill x -in .fr_dsofovc

pack .fr_nebula .fr_dsotype .fr_dsolblhint .fr_dsoeach_margin .fr_dsoinit_p0 .fr_dsoinit_p1 .fr_dsomarker .fr_dsozoom .fr_dsofovc_margin .fr_dsofovc -expand 0 -fill x -in .lf_dso_p0

build_dso_buttons "list_fov-circular.txt" "send_ssc_of_dso_fov_circular_marker" 4 "fovc" "p0"

.pw add .lf_dso_p0


################################################################

labelframe .lf_dso_p1 -text "Objects 1" -font $font_labelframe

frame .fr_dso_spring
label .l_dso_spring -text "$gui_tsl(SPRING)"
create_button_small .b_dso_ed_spring "$gui_tsl(EDIT)" "open_text_editor .edt_spri objects_spring.txt"
pack .l_dso_spring -side left -expand 1 -fill x -in .fr_dso_spring
pack .b_dso_ed_spring -side left -expand 0 -fill x -in .fr_dso_spring
pack .fr_dso_spring -expand 0 -fill x -in .lf_dso_p1

build_dso_buttons "objects_spring.txt" "select_a_dso" 3 "spring" "p1"

frame .fr_dso_p1_margin00 -height $margin_before_new_dso_block
pack .fr_dso_p1_margin00 -expand 0 -fill x -in .lf_dso_p1

frame .fr_dso_summer
label .l_dso_summer -text "$gui_tsl(SUMMER)"
create_button_small .b_dso_ed_summer "$gui_tsl(EDIT)" "open_text_editor .edt_summ objects_summer.txt"
pack .l_dso_summer -side left -expand 1 -fill x -in .fr_dso_summer
pack .b_dso_ed_summer -side left -expand 0 -fill x -in .fr_dso_summer
pack .fr_dso_summer -expand 0 -fill x -in .lf_dso_p1

build_dso_buttons "objects_summer.txt" "select_a_dso" 3 "summer" "p1"

frame .fr_dso_p1_margin01 -height $margin_before_new_dso_block
pack .fr_dso_p1_margin01 -expand 0 -fill x -in .lf_dso_p1

frame .fr_dso_etc1
label .l_dso_etc1 -text "etc.1"
create_button_small .b_dso_ed_etc1 "$gui_tsl(EDIT)" "open_text_editor .edt_etc1 objects_etc1.txt"
pack .l_dso_etc1 -side left -expand 1 -fill x -in .fr_dso_etc1
pack .b_dso_ed_etc1 -side left -expand 0 -fill x -in .fr_dso_etc1
pack .fr_dso_etc1 -expand 0 -fill x -in .lf_dso_p1

build_dso_buttons "objects_etc1.txt" "select_a_dso" 3 "etc1_" "p1"

.pw add .lf_dso_p1


################################################################

labelframe .lf_dso_p2 -text "Objects 2" -font $font_labelframe

frame .fr_dso_autumn
label .l_dso_autumn -text "$gui_tsl(AUTUMN)"
create_button_small .b_dso_ed_autumn "$gui_tsl(EDIT)" "open_text_editor .edt_autu objects_autumn.txt"
pack .l_dso_autumn -side left -expand 1 -fill x -in .fr_dso_autumn
pack .b_dso_ed_autumn -side left -expand 0 -fill x -in .fr_dso_autumn
pack .fr_dso_autumn -expand 0 -fill x -in .lf_dso_p2

build_dso_buttons "objects_autumn.txt" "select_a_dso" 3 "autumn" "p2"

frame .fr_dso_p2_margin00 -height $margin_before_new_dso_block
pack .fr_dso_p2_margin00 -expand 0 -fill x -in .lf_dso_p2

frame .fr_dso_winter
label .l_dso_winter -text "$gui_tsl(WINTER)"
create_button_small .b_dso_ed_winter "$gui_tsl(EDIT)" "open_text_editor .edt_wint objects_winter.txt"
pack .l_dso_winter -side left -expand 1 -fill x -in .fr_dso_winter
pack .b_dso_ed_winter -side left -expand 0 -fill x -in .fr_dso_winter
pack .fr_dso_winter -expand 0 -fill x -in .lf_dso_p2

build_dso_buttons "objects_winter.txt" "select_a_dso" 3 "winter" "p2"

frame .fr_dso_p2_margin01 -height $margin_before_new_dso_block
pack .fr_dso_p2_margin01 -expand 0 -fill x -in .lf_dso_p2

frame .fr_dso_etc2
label .l_dso_etc2 -text "etc.2"
create_button_small .b_dso_ed_etc2 "$gui_tsl(EDIT)" "open_text_editor .edt_etc2 objects_etc2.txt"
pack .l_dso_etc2 -side left -expand 1 -fill x -in .fr_dso_etc2
pack .b_dso_ed_etc2 -side left -expand 0 -fill x -in .fr_dso_etc2
pack .fr_dso_etc2 -expand 0 -fill x -in .lf_dso_p2

build_dso_buttons "objects_etc2.txt" "select_a_dso" 3 "etc2_" "p2"

.pw add .lf_dso_p2


################################################################

labelframe .lf_gridlines -text "Grid Lines" -font $font_labelframe

frame .fr_grid_disp0
create_button_code .b_grid_reset "$gui_tsl(GROUP_RESET)" "reset_gridlines"
label .l_grid_disp -text "$gui_tsl(GRIDLINES_SHOW)"
pack .b_grid_reset -anchor n -pady [list 0 $pad_bottom_for_group_reset_button] -side left -in .fr_grid_disp0
pack .l_grid_disp  -anchor s -side left -expand 1 -fill x -in .fr_grid_disp0
frame .fr_grid_disp1
create_button .b_grid_disp1 "ON" "exec_ssc_on_server setFlagGridLines.ssc"
create_button .b_grid_disp0 "Off" "exec_ssc_on_server unsetFlagGridLines.ssc"
pack .b_grid_disp0 .b_grid_disp1 -side left -expand 1 -fill x -in .fr_grid_disp1

frame .fr_grid_azim
label .l_grid_azim -text "$gui_tsl(GRID_AZI_GRID)"
create_button .b_grid_azim1 " SET " "send_ssc_lines GridLinesMgr.setFlagAzimuthalGrid(true)"
create_button .b_grid_azim0 "Unset" "send_ssc_lines GridLinesMgr.setFlagAzimuthalGrid(false)"
pack .l_grid_azim -in .fr_grid_azim
pack .b_grid_azim0 .b_grid_azim1 -side left -expand 1 -fill x -in .fr_grid_azim

frame .fr_grid_eclip
label .l_grid_eclip -text "$gui_tsl(GRID_ECL_GRID)"
create_button .b_grid_eclip1 " SET " "send_ssc_lines GridLinesMgr.setFlagEclipticGrid(true)"
create_button .b_grid_eclip0 "Unset" "send_ssc_lines GridLinesMgr.setFlagEclipticGrid(false)"
pack .l_grid_eclip -in .fr_grid_eclip
pack .b_grid_eclip0 .b_grid_eclip1 -side left -expand 1 -fill x -in .fr_grid_eclip

frame .fr_grid_eclipl
label .l_grid_eclipl -text "$gui_tsl(GRID_ECL_LINE)"
create_button .b_grid_eclipl2 "DATE" "send_or_exec_ssc GridLinesMgr.setFlagEclipticLine(true) setEclipticDateLabels.ssc"
create_button .b_grid_eclipl1 "SET" "send_or_exec_ssc unsetEclipticDateLabels.ssc GridLinesMgr.setFlagEclipticLine(true)"
create_button .b_grid_eclipl0 "Unset" "send_or_exec_ssc unsetEclipticDateLabels.ssc GridLinesMgr.setFlagEclipticLine(false)"
pack .l_grid_eclipl -in .fr_grid_eclipl
pack .b_grid_eclipl0 .b_grid_eclipl1 .b_grid_eclipl2 -side left -expand 1 -fill x -in .fr_grid_eclipl

frame .fr_grid_equat
label .l_grid_equat -text "$gui_tsl(GRID_EQU_GRID)"
create_button .b_grid_equat1 " SET " "send_ssc_lines GridLinesMgr.setFlagEquatorGrid(true)"
create_button .b_grid_equat0 "Unset" "send_ssc_lines GridLinesMgr.setFlagEquatorGrid(false)"
pack .l_grid_equat -in .fr_grid_equat
pack .b_grid_equat0 .b_grid_equat1 -side left -expand 1 -fill x -in .fr_grid_equat

frame .fr_grid_equatl
label .l_grid_equatl -text "$gui_tsl(GRID_EQU_LINE)"
create_button .b_grid_equatl1 " SET " "send_ssc_lines GridLinesMgr.setFlagEquatorLine(true)"
create_button .b_grid_equatl0 "Unset" "send_ssc_lines GridLinesMgr.setFlagEquatorLine(false)"
pack .l_grid_equatl -in .fr_grid_equatl
pack .b_grid_equatl0 .b_grid_equatl1 -side left -expand 1 -fill x -in .fr_grid_equatl

frame .fr_grid_sundnl
label .l_grid_sundnl -text "$gui_tsl(GRID_SUN_DMOTION)"
create_button .b_grid_sundnl1 " SET " "exec_ssc_on_server setSunDiurnalMotion.ssc"
create_button .b_grid_sundnl0 "Unset" "exec_ssc_on_server unsetSunDiurnalMotion.ssc"
pack .l_grid_sundnl -in .fr_grid_sundnl
pack .b_grid_sundnl0 .b_grid_sundnl1 -side left -expand 1 -fill x -in .fr_grid_sundnl

frame .fr_grid_galact
label .l_grid_galact -text "$gui_tsl(GRID_GAL_GRID)"
create_button .b_grid_galact1 " SET " "send_ssc_lines GridLinesMgr.setFlagGalacticGrid(true)"
create_button .b_grid_galact0 "Unset" "send_ssc_lines GridLinesMgr.setFlagGalacticGrid(false)"
pack .l_grid_galact -in .fr_grid_galact
pack .b_grid_galact0 .b_grid_galact1 -side left -expand 1 -fill x -in .fr_grid_galact

frame .fr_grid_galactl
label .l_grid_galactl -text "$gui_tsl(GRID_GAL_LINE)"
create_button .b_grid_galactl1 " SET " "send_ssc_lines GridLinesMgr.setFlagGalacticEquatorLine(true)"
create_button .b_grid_galactl0 "Unset" "send_ssc_lines GridLinesMgr.setFlagGalacticEquatorLine(false)"
pack .l_grid_galactl -in .fr_grid_galactl
pack .b_grid_galactl0 .b_grid_galactl1 -side left -expand 1 -fill x -in .fr_grid_galactl

pack .fr_grid_disp0 .fr_grid_disp1 .fr_grid_azim .fr_grid_eclip .fr_grid_eclipl .fr_grid_equat .fr_grid_equatl .fr_grid_sundnl .fr_grid_galact .fr_grid_galactl -expand 0 -fill x -in .lf_gridlines

.pw add .lf_gridlines


################################################################

labelframe .lf_config -text "Configuration" -font $font_labelframe

frame .fr_mnt_gui
label .l_mnt_gui -text "GUI & Info of Screen" -font $font_small -pady 0
create_button_small .b_mnt_gui0 "Off" "send_ssc_lines StelMovementMgr.setFlagEnableMouseZooming(false) StelMovementMgr.setFlagEnableMouseNavigation(false) core.setSelectedObjectMarkerVisible(false) core.setGuiVisible(false) core.setSelectedObjectInfo('None')"
create_button_small .b_mnt_gui1 "GUI" "send_ssc_lines StelMovementMgr.setFlagEnableMouseZooming(true) StelMovementMgr.setFlagEnableMouseNavigation(true) core.setSelectedObjectMarkerVisible(true) core.setGuiVisible(true) core.setSelectedObjectInfo('None')"
create_button_small .b_mnt_gui2 "INFO1" "send_ssc_lines StelMovementMgr.setFlagEnableMouseZooming(true) StelMovementMgr.setFlagEnableMouseNavigation(true) core.setSelectedObjectMarkerVisible(true) core.setGuiVisible(true) core.setSelectedObjectInfo('ShortInfo')"
create_button_small .b_mnt_gui3 "2" "send_ssc_lines StelMovementMgr.setFlagEnableMouseZooming(true) StelMovementMgr.setFlagEnableMouseNavigation(true) core.setSelectedObjectMarkerVisible(true) core.setGuiVisible(true) core.setSelectedObjectInfo('DefaultInfo')"
create_button_small .b_mnt_gui4 "3" "send_ssc_lines StelMovementMgr.setFlagEnableMouseZooming(true) StelMovementMgr.setFlagEnableMouseNavigation(true) core.setSelectedObjectMarkerVisible(true) core.setGuiVisible(true) core.setSelectedObjectInfo('AllInfo')"
pack .l_mnt_gui -in .fr_mnt_gui
pack .b_mnt_gui0 .b_mnt_gui1 .b_mnt_gui2 -side left -fill x -in .fr_mnt_gui
pack .b_mnt_gui3 .b_mnt_gui4 -side left -expand 1 -fill x -in .fr_mnt_gui

#frame .fr_mnt_msz
#label .l_mnt_msz -text "Mouse Zoom & Navi" -font $font_small
#create_button_small .b_mnt_msz0 "Off" "send_ssc_lines StelMovementMgr.setFlagEnableMouseZooming(false) StelMovementMgr.setFlagEnableMouseNavigation(false)"
#create_button_small .b_mnt_msz1 "ON" "send_ssc_lines StelMovementMgr.setFlagEnableMouseZooming(true) StelMovementMgr.setFlagEnableMouseNavigation(true)"
#pack .l_mnt_msz -in .fr_mnt_msz
#pack .b_mnt_msz0 .b_mnt_msz1 -side left -expand 1 -fill x -in .fr_mnt_msz

frame .fr_mnt_margin_0 -height $margin_before_new_block

frame .fr_mnt_viewcfglbl
label .l_mnt_viewcfglbl -text "View Config" -font $font_small -background $label_new_block_background -foreground $label_new_block_foreground
pack .l_mnt_viewcfglbl -side left -expand 1 -fill x -in .fr_mnt_viewcfglbl

set buffer_display_gamma $asarr_initial_settings(DisplayGamma)
frame .fr_mnt_gamma
label .l_mnt_gamma -text "Display Gamma" -font $font_small -pady 0
create_button_small .b_mnt_gamma0 "$gui_tsl(INIT_S)" "send_ssc_of_display_gamma -"
#entry .e_mnt_gamma -font $font_small -width 6 -textvariable buffer_display_gamma
ttk::entry .e_mnt_gamma -font $font_small -width 6 -textvariable buffer_display_gamma
#create_button_small .b_mnt_gamma1 "SET" "send_ssc_of_display_gamma"
create_button_small .b_mnt_gamma1 "$gui_tsl(ARR_D_LEFT)" "send_ssc_of_display_gamma -0.1"
create_button_small .b_mnt_gamma2 "<" "send_ssc_of_display_gamma -0.01"
create_button_small .b_mnt_gamma3 ">" "send_ssc_of_display_gamma +0.01"
create_button_small .b_mnt_gamma4 "$gui_tsl(ARR_D_RIGHT)" "send_ssc_of_display_gamma +0.1"
bind .e_mnt_gamma <Return> "send_ssc_of_display_gamma"
pack .l_mnt_gamma -in .fr_mnt_gamma
pack .b_mnt_gamma0 -side left -fill both -in .fr_mnt_gamma
pack .e_mnt_gamma -expand 1 -side left -fill both -in .fr_mnt_gamma
pack .b_mnt_gamma1 .b_mnt_gamma2 .b_mnt_gamma3 .b_mnt_gamma4 -side left -fill both -in .fr_mnt_gamma

set buffer_projection_mode $asarr_initial_settings(ProjectionMode)
if { 25 <= [get_stellarium_major_version] } {
  set pjmod {
    "ProjectionPerspective"
    "ProjectionEqualArea"
    "ProjectionStereographic"
    "ProjectionFisheye"
    "ProjectionHammer"
    "ProjectionMollweide"
    "ProjectionCylinder"
    "ProjectionMercator"
    "ProjectionOrthographic"
    "ProjectionSinusoidal"
    "ProjectionMiller"
  }
} else {
  set pjmod {
    "ProjectionPerspective"
    "ProjectionEqualArea"
    "ProjectionStereographic"
    "ProjectionFisheye"
    "ProjectionHammer"
    "ProjectionCylinder"
    "ProjectionMercator"
    "ProjectionOrthographic"
    "ProjectionSinusoidal"
    "ProjectionMiller"
  }
}
frame .fr_mnt_pjmod
label .l_mnt_pjmod -text "Projection Mode" -font $font_small -pady 0
ttk::combobox .cb_mnt_pjmod -textvariable buffer_projection_mode -values $pjmod -font $font_small -state readonly
bind .cb_mnt_pjmod <<ComboboxSelected>> { send_ssc_of_projection_mode }
pack .l_mnt_pjmod -in .fr_mnt_pjmod
pack .cb_mnt_pjmod -side left -expand 1 -fill x -in .fr_mnt_pjmod

set buffer_disk_viewport $asarr_initial_settings(DiskViewport)
frame .fr_mnt_diskview
label .l_mnt_diskview -text "Disk Viewport" -font $font_small -pady 0
create_button_small .b_mnt_diskview0 "$gui_tsl(INIT)" "send_ssc_of_disk_viewport -"
create_button_small .b_mnt_diskview1 "Off" "send_ssc_of_disk_viewport false"
create_button_small .b_mnt_diskview2 "ON" "send_ssc_of_disk_viewport true"
pack .l_mnt_diskview -in .fr_mnt_diskview
pack .b_mnt_diskview0 -side left -fill x -in .fr_mnt_diskview
pack .b_mnt_diskview1 .b_mnt_diskview2 -expand 1 -side left -fill x -in .fr_mnt_diskview

set buffer_view_fov $asarr_initial_settings(ViewFov)
frame .fr_mnt_fov
label .l_mnt_fov -text "View FOV" -font $font_small -pady 0
create_button_small .b_mnt_fov0 "$gui_tsl(INIT_S)" "send_ssc_of_view_fov -"
#entry .e_mnt_fov -font $font_small -width 6 -textvariable buffer_view_fov
ttk::entry .e_mnt_fov -font $font_small -width 6 -textvariable buffer_view_fov
#create_button_small .b_mnt_fov1 "SET" "send_ssc_of_view_fov"
create_button_small .b_mnt_fov1 "$gui_tsl(ARR_D_LEFT)" "send_ssc_of_view_fov -5.0"
create_button_small .b_mnt_fov2 "<" "send_ssc_of_view_fov -0.5"
create_button_small .b_mnt_fov3 ">" "send_ssc_of_view_fov +0.5"
create_button_small .b_mnt_fov4 "$gui_tsl(ARR_D_RIGHT)" "send_ssc_of_view_fov +5.0"
bind .e_mnt_fov <Return> "send_ssc_of_view_fov"
pack .l_mnt_fov -in .fr_mnt_fov
pack .b_mnt_fov0 -side left -fill both -in .fr_mnt_fov
pack .e_mnt_fov -expand 1 -side left -fill both -in .fr_mnt_fov
pack .b_mnt_fov1 .b_mnt_fov2 .b_mnt_fov3 .b_mnt_fov4 -side left -fill both -in .fr_mnt_fov

set buffer_viewport_x $asarr_initial_settings(ViewportX)
frame .fr_mnt_vpx
label .l_mnt_vpx -text "Viewport X" -font $font_small -pady 0
create_button_small .b_mnt_vpx0 "$gui_tsl(INIT_S)" "send_ssc_of_viewport_x -"
#entry .e_mnt_vpx -font $font_small -width 6 -textvariable buffer_viewport_x
ttk::entry .e_mnt_vpx -font $font_small -width 6 -textvariable buffer_viewport_x
#create_button_small .b_mnt_vpx1 "SET" "send_ssc_of_viewport_x"
create_button_small .b_mnt_vpx1 "$gui_tsl(ARR_D_LEFT)" "send_ssc_of_viewport_x -0.1"
create_button_small .b_mnt_vpx2 "<" "send_ssc_of_viewport_x -0.01"
create_button_small .b_mnt_vpx3 ">" "send_ssc_of_viewport_x +0.01"
create_button_small .b_mnt_vpx4 "$gui_tsl(ARR_D_RIGHT)" "send_ssc_of_viewport_x +0.1"
bind .e_mnt_vpx <Return> "send_ssc_of_viewport_x"
pack .l_mnt_vpx -in .fr_mnt_vpx
pack .b_mnt_vpx0 -side left -fill both -in .fr_mnt_vpx
pack .e_mnt_vpx -expand 1 -side left -fill both -in .fr_mnt_vpx
pack .b_mnt_vpx1 .b_mnt_vpx2 .b_mnt_vpx3 .b_mnt_vpx4 -side left -fill both -in .fr_mnt_vpx

set buffer_viewport_y $asarr_initial_settings(ViewportY)
frame .fr_mnt_vpy
label .l_mnt_vpy -text "Viewport Y" -font $font_small -pady 0
create_button_small .b_mnt_vpy0 "$gui_tsl(INIT_S)" "send_ssc_of_viewport_y -"
#entry .e_mnt_vpy -font $font_small -width 6 -textvariable buffer_viewport_y
ttk::entry .e_mnt_vpy -font $font_small -width 6 -textvariable buffer_viewport_y
#create_button_small .b_mnt_vpy1 "SET" "send_ssc_of_viewport_y"
create_button_small .b_mnt_vpy1 "$gui_tsl(ARR_D_LEFT)" "send_ssc_of_viewport_y -0.1"
create_button_small .b_mnt_vpy2 "<" "send_ssc_of_viewport_y -0.01"
create_button_small .b_mnt_vpy3 ">" "send_ssc_of_viewport_y +0.01"
create_button_small .b_mnt_vpy4 "$gui_tsl(ARR_D_RIGHT)" "send_ssc_of_viewport_y +0.1"
bind .e_mnt_vpy <Return> "send_ssc_of_viewport_y"
pack .l_mnt_vpy -in .fr_mnt_vpy
pack .b_mnt_vpy0 -side left -fill both -in .fr_mnt_vpy
pack .e_mnt_vpy -expand 1 -side left -fill both -in .fr_mnt_vpy
pack .b_mnt_vpy1 .b_mnt_vpy2 .b_mnt_vpy3 .b_mnt_vpy4 -side left -fill both -in .fr_mnt_vpy

set buffer_view_altitude $asarr_initial_settings(ViewAltitude)
frame .fr_mnt_altitude
label .l_mnt_altitude -text "View Altitude" -font $font_small -pady 0
create_button_small .b_mnt_altitude0 "$gui_tsl(INIT_S)" "send_ssc_of_view_altitude -"
#entry .e_mnt_altitude -font $font_small -width 6 -textvariable buffer_view_altitude
ttk::entry .e_mnt_altitude -font $font_small -width 6 -textvariable buffer_view_altitude
#create_button_small .b_mnt_altitude1 "SET" "send_ssc_of_view_altitude"
create_button_small .b_mnt_altitude1 "$gui_tsl(ARR_D_LEFT)" "send_ssc_of_view_altitude -5.0"
create_button_small .b_mnt_altitude2 "<" "send_ssc_of_view_altitude -0.5"
create_button_small .b_mnt_altitude3 ">" "send_ssc_of_view_altitude +0.5"
create_button_small .b_mnt_altitude4 "$gui_tsl(ARR_D_RIGHT)" "send_ssc_of_view_altitude +5.0"
bind .e_mnt_altitude <Return> "send_ssc_of_view_altitude"
pack .l_mnt_altitude -in .fr_mnt_altitude
pack .b_mnt_altitude0 -side left -fill both -in .fr_mnt_altitude
pack .e_mnt_altitude -expand 1 -side left -fill both -in .fr_mnt_altitude
pack .b_mnt_altitude1 .b_mnt_altitude2 .b_mnt_altitude3 .b_mnt_altitude4 -side left -fill both -in .fr_mnt_altitude

set buffer_view_azimuth $asarr_initial_settings(ViewAzimuth)
frame .fr_mnt_azimuth
label .l_mnt_azimuth -text "View Azimuth" -font $font_small -pady 0
create_button_small .b_mnt_azimuth0 "$gui_tsl(INIT_S)" "send_ssc_of_view_azimuth -"
#entry .e_mnt_azimuth -font $font_small -width 6 -textvariable buffer_view_azimuth
ttk::entry .e_mnt_azimuth -font $font_small -width 6 -textvariable buffer_view_azimuth
#create_button_small .b_mnt_azimuth1 "SET" "send_ssc_of_view_azimuth"
create_button_small .b_mnt_azimuth1 "$gui_tsl(ARR_D_LEFT)" "send_ssc_of_view_azimuth -10.0"
create_button_small .b_mnt_azimuth2 "<" "send_ssc_of_view_azimuth -1.0"
create_button_small .b_mnt_azimuth3 ">" "send_ssc_of_view_azimuth +1.0"
create_button_small .b_mnt_azimuth4 "$gui_tsl(ARR_D_RIGHT)" "send_ssc_of_view_azimuth +10.0"
bind .e_mnt_azimuth <Return> "send_ssc_of_view_azimuth"
pack .l_mnt_azimuth -in .fr_mnt_azimuth
pack .b_mnt_azimuth0 -side left -fill both -in .fr_mnt_azimuth
pack .e_mnt_azimuth -expand 1 -side left -fill both -in .fr_mnt_azimuth
pack .b_mnt_azimuth1 .b_mnt_azimuth2 .b_mnt_azimuth3 .b_mnt_azimuth4 -side left -fill both -in .fr_mnt_azimuth

pack .fr_mnt_gui .fr_mnt_gamma .fr_mnt_pjmod .fr_mnt_diskview .fr_mnt_fov .fr_mnt_vpx .fr_mnt_vpy .fr_mnt_altitude .fr_mnt_azimuth -expand 0 -fill x -in .lf_config

####

if { $flag_host_gui != 0 } {

  frame .fr_mnt_margin_1 -height $margin_before_new_block

  frame .fr_mnt_edlbl
  label .l_mnt_edlbl -text "$gui_tsl(CONF_EDIT_CONF)" -font $font_small -background $label_new_block_background -foreground $label_new_block_foreground
  pack .l_mnt_edlbl -side left -expand 1 -fill x -in .fr_mnt_edlbl

  pack .fr_mnt_margin_1 .fr_mnt_edlbl -expand 0 -fill x -in .lf_config

  create_button_small .b_mnt_ed00 "localConfig.ssc" "open_text_editor .edt_cfg0 localConfig.ssc"
  create_button_small .b_mnt_ed01 "localInitView.ssc" "open_text_editor .edt_cfg1 localInitView.ssc"
  create_button_small .b_mnt_ed02 "localInitLocation.ssc" "open_text_editor .edt_cfg2 localInitLocation.ssc"
  create_button_small .b_mnt_ed03 "localInitSettings.ssc" "open_text_editor .edt_cfg3 localInitSettings.ssc"

  pack .b_mnt_ed00 .b_mnt_ed01 .b_mnt_ed02 .b_mnt_ed03 -expand 0 -fill x -in .lf_config

  if { $flag_dome_mode != 0 } {
    create_button_small .b_mnt_ed06 "date-monitor_conf.txt" "open_text_editor .edt_cfg6 date-monitor_conf.txt"
    pack .b_mnt_ed06 -expand 0 -fill x -in .lf_config
  }

  create_button_small .b_mnt_ed09 "$gui_tsl(OPEN_FOLDER)" "exec explorer.exe . &"
  pack .b_mnt_ed09 -expand 0 -fill x -in .lf_config

}

.pw add .lf_config


################################################################

labelframe .lf_objinfo -text "Object Info" -font $font_labelframe

set buffer_object_info ""

#

frame .fr_objinfo_1

# GUI のサイズごとに横幅を調整する
if { $flag_large_gui == 0 } {
  # Normal GUI
  text .t_objinfo -font $font_small -width 68 -yscrollcommand ".sb_objinfo set" -state disabled -wrap char
} else {
  # Large GUI
  text .t_objinfo -font $font_small -width 69 -yscrollcommand ".sb_objinfo set" -state disabled -wrap char
}
scrollbar .sb_objinfo -command ".t_objinfo yview"

pack .t_objinfo -side left -expand 1 -fill both -in .fr_objinfo_1
pack .sb_objinfo -side left -expand 0 -fill y -in .fr_objinfo_1

pack .fr_objinfo_1 -expand 1 -fill both -in .lf_objinfo

#

frame .fr_objinfo_margin -height [scaled_px 2]
pack .fr_objinfo_margin -in .lf_objinfo

frame .fr_objinfo_2

create_button_small .b_objinfo_reload "$gui_tsl(OBJINFO_RELOAD)" "get_object_data_from_stellarium_and_set"
label .l_objinfo_spc -text "" -font $font_small
create_button_small .b_objinfo_copy "$gui_tsl(OBJINFO_COPY_TO_CLIP)" "set_object_text_to_clipboard"
pack .b_objinfo_reload  -side left -in .fr_objinfo_2
pack .l_objinfo_spc -expand 1 -side left -in .fr_objinfo_2
pack .b_objinfo_copy -side left -in .fr_objinfo_2

pack .fr_objinfo_2 -fill x -in .lf_objinfo

#

.pw add .lf_objinfo


################################################################

set list_documents {
  "https://stellarium.org/doc/head/scripting.html"
  "http://www.nct9.ne.jp/m_hiroi/tcl_tk_doc/"
}
set counter_list_documents 0

proc show_one_in_list_documents {} {
  global list_documents
  global counter_list_documents
  global buffer_codefield
  set len_list [llength $list_documents]
  if { $len_list <= $counter_list_documents } {
    set counter_list_documents 0
  }
  set buffer_codefield [lindex $list_documents $counter_list_documents]
  incr counter_list_documents
}

labelframe .lf_codefield -text "Log / Send or Exec an SSC" -font $font_labelframe

#entry .e_code -font $font_codefield -textvariable buffer_codefield
ttk::entry .e_code -font $font_codefield -textvariable buffer_codefield
bind .e_code <Return> "send_ssc_from_codefield"
create_button_code .b_code0 "Clr"  "set buffer_codefield \"\""
create_button_code .b_code1 "Date" "set_buffer_codefield_from_buffer_datearg"
create_button_code .b_code2 "Doc"  "show_one_in_list_documents"
create_button_code .b_code3 "EXEC" "send_ssc_from_codefield"
pack .b_code0 .b_code1 .b_code2 -side left -in .lf_codefield
pack .e_code -side left -expand 1 -fill both -in .lf_codefield
pack .b_code3 -side left -in .lf_codefield

pack .lf_codefield -side left -expand 1 -fill both -padx [scaled_px 4] -pady [scaled_px 2] -in .fr_rootwin

# combobox のバッファ
set buffer_cb_app_language $asarr_initial_settings(AppLanguage)
# setAppLanguage() に与えられるもの
set buffer_app_language $asarr_initial_settings(AppLanguage)

set app_languages {
  "ja_JP"
  "KANA"
  "en_US"
  "fr_FR"
  "es_ES"
  "it_IT"
  "pt_PT"
  "de_DE"
  "ru_RU"
  "zh_TW"
}

labelframe .lf_options -text "Options" -font $font_labelframe
label .l_app_language -text "Lang" -font $font_small
ttk::combobox .cb_app_language -textvariable buffer_cb_app_language -values $app_languages -font $font_small -width 5 -state readonly
bind .cb_app_language <<ComboboxSelected>> { send_ssc_of_app_language }

if { 0 <= [get_stellarium_major_version] } {
  pack .l_app_language .cb_app_language -side left -in .lf_options
}

if { [get_stellarium_major_version] <= 0 } {
  if { "$gui_tsl(OPTIONS_CB_KANA)" ne "" } {
    ttk::checkbutton .cb_ruby -text "$gui_tsl(OPTIONS_CB_KANA)" -variable flag_ruby_of_labels -style "Small.TCheckbutton" -command update_gui_label_supported_ruby
    pack .cb_ruby -side left -in .lf_options
  }
}

frame .fr_spc_before_cb_editor -width [scaled_px 3]
pack .fr_spc_before_cb_editor -side left -in .lf_options

ttk::checkbutton .cb_editor -text "$gui_tsl(OPTIONS_CB_EXTEDITOR)" -variable flag_external_editor -style "Small.TCheckbutton"
pack .cb_editor -side left -in .lf_options

pack .lf_options -expand 0 -fill both -padx [scaled_px 4] -pady [scaled_px 2] -in .fr_rootwin



########################################################################

pack .fr_rootwin

########################################################################

deselect_all
select_general


####################################################################
##                                                                ##
##                          M A I N (2)                           ##
##                                                                ##
####################################################################

source -encoding $TCLSRC_ENCODING media-gui.tcl
source -encoding $TCLSRC_ENCODING date-gui.tcl

if { $flag_initialize != 0 } {

  if { $flag_host_gui != 0 } {

    set iscserv_root [get_stellarium_io_directory]

    set filename "$iscserv_root/_tmp_starLabels.isc.txt"
    set st [reset_a_file $filename]
    if { $st != 0 } {
      wm state . normal
      tk_messageBox -type ok -icon info -title "ERROR" -message "Unable to open $filename for writing"
    }
    set filename "$iscserv_root/initialSettings.isc.txt"
    set st [reset_a_file $filename]
    if { $st != 0 } {
      wm state . normal
      tk_messageBox -type ok -icon info -title "ERROR" -message "Unable to open $filename for writing"
    }

  }

  send_ssc_to_initialize_all 0

} else {

  # ISC Serverに保存された初期値を取得
  get_initial_settings_to asarr_initial_settings

  set flag_initialized 0

  if { $flag_host_gui != 0 } {

    # 異なるモードの場合は全初期化

    set current_is_dome_mode [get_flag_dome_mode_on_server]

    if { $flag_dome_mode == 0 } {
      if { $current_is_dome_mode != 0 } {
        send_ssc_to_initialize_all 1 1
        set flag_initialized 1
      }
    } else {
      if { $current_is_dome_mode == 0 } {
        send_ssc_to_initialize_all 1 1
        set flag_initialized 1
      }
    }

  }

  if { $flag_initialized == 0 } {
    # GUIパラメータのリロード
    reload_all_gui_params
  }

}

#######################################################################

# display main window
wm state . normal
raise .

#######################################################################

#
# media GUI のセットアップ (media-gui.tcl)
# (設定ファイルをISC Serverのrootにコピーしてすぐ終了)
#

if { $flag_host_gui != 0 } {
  open_media_gui .media_gui 1
}

#
# 日付時刻GUI を起動 (date-gui.tcl)
#

open_date_gui .date_gui

#
# 日付時刻表示系 無限ループ (date-gui.tcl)
#

show_date_time_info

#######################################################################

