# Default resources for GUI Windows (tk fashion)
#f4ff90 yellow
#bcc0e6
#b8bbe6
#7c7cae
#{Helvetica -12} 

module TkDefaults

  class GuiOptions 

    def initialize
      @tree= {}
    end
    def []= (path, val)
      insert(@tree,path.split('.'),val)
    end

    def insert (h,path,val)
      if path.empty?
        if h['Default']
          table= h['Default']
          val.each_pair{ |key,value| table[key]=value}
        else
          h['Default']=val
        end
      else
        item= path.shift
        if h[item].nil?
          h[item] = Hash.new
        end
        insert(h[item] , path, val)
      end
    end

    def  [] (path)
      result= Hash.new
      f= find(@tree,path.split('.'))
      unless f.nil?
        result.update(f)
      end
      result
    end

    def find (h,path)
      if path.empty?
        h['Default'].clone unless h['Default'].nil?
      else
        item= path.shift
        if h[item].nil?
          h['Default'].clone unless h['Default'].nil?
        else
          if h['Default'].nil?
            find(h[item] , path)
          else
            f= find(h[item] , path)
            if f.nil?
              h['Default'].clone
            else
              h['Default'].clone.update( f)
            end   
          end
        end
      end
    end

    def update (path, val)
      orig= self[path]
      orig.update(val)
      self[path]= orig
    end

  end

  def TkDefaults.set_top_options(obj,top)

    if obj.kind_of? String
      label= obj
    else
      label= obj.class.to_s
      end

      name=label+'.top'

      GUI[name].each_pair {|method,param|   if param.kind_of?(Array)
        top.send(method,*param)
    else 
      top.send(method,param)
    end }

      if geom=Defaults.get_default_value(label+'_geom')
        top.geometry(geom.value)
      end
  end

  def TkDefaults.save_top_options(obj,top)
    return unless top
    if obj.kind_of? String
      label= obj
    else
      label= obj.class.to_s
      end
      if  RUBY_VERSION =~ /1\.8/
        geom= top.geometry(nil) # 1.8
      else
        geom= top.geometry unless geom # 1.6
      end   

      unless resize= GUI[label+'.top']['resizable']
        resize = ['true','true']
      end

      if geom =~ /^(\d+)x(\d+)([\+\-]+\d+[\+\-]+\d+)/

        str= ''
        str << $1 + 'x' + $2 if resize[0] == 'true' and resize[1] == 'true'
        str << $3


        Defaults.set_default_value(label+'_geom', str)
      end

    end


    BlueBg= '#b8bbe6'
    TkPalette.setPalette(BlueBg)

    image_path= File.join( File.join($current_path, '..'),'images')
    class << image_path
      def + (arg)
        File.join(self,arg)
      end
    end


    GUI=GuiOptions.new

    GUI['go.top']= {  'title'=> 'Ruby::Go '+$version.to_s, 'resizable' => ['false','false'], 'geometry' => '+0+0' }
    GUI['go.frame']=  {  'relief' => 'ridge', 'borderwidth' => 4}
    GUI['go.image.editor']= { 'image' => TkPhotoImage.new('file'=>image_path + 'editor.gif'),
		'text'=> 'Create/edit a  game',
       'balloon'=> "Create/edit a SGF file
SGF is the standard format for Go games."}
    GUI['go.image.client']= { 'image' => TkPhotoImage.new('file'=>image_path + 'client.gif'),
		'text'=>'Connect to the server ',
        'balloon'=> "Connect to the server and play Go !!"}
    GUI['go.image.replay']= { 'image' => TkPhotoImage.new('file'=>image_path + 'replay.gif'),
		'text'=> 'Replay a game',
        'balloon'=> "Replay a game stored in a SGF file.
By using this you are sure that the file can't be modified"}

    GUI['go.image.gnugo']= { 'image' => TkPhotoImage.new('file'=>image_path + 'gnugo.gif'),
		'text'=>'Play with GnuGo',
        'balloon'=> "Play against the computer"}

  GUI['go.image.goprobs']= { 'image' => TkPhotoImage.new('file'=>image_path + 'goprobs.gif'),
		'text'=>'Solve problems',
        'balloon'=> "Train on problems"}


    $fixed_font= ( if $platform == 'windows'
                  TkFont.new('Fixedsys')
  else 
#TkFont.new('family'=>"Helvetica", "size"=>10, "weight"=>"bold")
#TkFont.new('user') # fixed width
#TkFont.new('terminal') # fixed width
    TkFont.new('fixed')
  end ) 

#puts font.actual
#puts font.configinfo

    GUI['GameInfo.text.game_info']= {'text' => '','fill'=> 'white','font'=>$fixed_font}
    GUI['GameInfo.text.game_type']= {'text' => '','fill'=> 'yellow','font'=>$fixed_font}
    GUI['GameInfo.text.handicap_info']= {'text' => 'Handicap: 0','fill'=> 'black'}
    GUI['GameInfo.text.komi_info']= { 'text' => 'Komi: 0.0','fill'=> 'black' }
    GUI['GameInfo.text.byo-yomi']= { 'text' => 'Byo-yomi','fill'=> 'yellow'}
    GUI['GameInfo.text.byo_time']= { 'text' => '','fill'=> 'black' }
    GUI['GameInfo.text.byo_stones']= { 'text' => '','fill'=> 'black' }
    GUI['GameInfo.text.byo_number']= { 'text' => '','fill'=> 'black' }
    GUI['GameInfo.text.move_info']= {'text' => '','fill'=> 'yellow'}
    GUI['GameInfo.text.move_number']= {'text' => '','fill'=> 'black'}
    GUI['GameInfo.text.status_info']= { 'fill'=>'black','font'=>$fixed_font }
    GUI['GameInfo.text.time_info']= { 'text' => '','fill'=> 'black' }

    GUI['GoObserver.top']= {'title' =>  'Go Observer: '}

    GUI['PlayerInfo.label.clock']= {'relief' => 'ridge','borderwidth'=>4,'padx'=>2,
        'balloon'=> " When this clock is zero, there is two possibilities:
- If you are in the absolute time, and there is a byo-yomi time, you will have
  <byo time> to play <byo-stones>.
- If you are already in the byo-yomi time, the game is losed ;->"}
    GUI['PlayerInfo.frame']= {'relief' => 'groove','borderwidth'=>4 ,'width'=>128, 'height'=>128}

    GUI['GoPlayer.top']= {'title' => 'Go Player: '}

    GUI['GoPlayer.button.free']= {'image' => TkPhotoImage.new('file'=>image_path + 'btn.free.gif'),
        'balloon' => " When one player send 'free', the game will not count towards rating.
Note that another 'free' will toggle the game rated again."}
    GUI['GoPlayer.button.Handicap']= {'image' => TkPhotoImage.new('file'=>image_path + 'btn.handicap.gif'),
        'balloon' => "This command must be the first move of black"}
    GUI['GoPlayer.button.Add time']= {'image' => TkPhotoImage.new('file'=>image_path + 'btn.addtime.gif'),
        'balloon' => "Add time to the other player. 
(time is in minutes)"}
    GUI['GoPlayer.button.undo']= {'image' => TkPhotoImage.new('file'=>image_path + 'btn.undo.gif'),
        'balloon' => "undo the last move of your opponent."}
    GUI['GoPlayer.button.pass']= {'image' => TkPhotoImage.new('file'=>image_path + 'btn.pass.gif'),
        'balloon'=> "The game is over after three passes."}
    GUI['GoPlayer.button.adjourn']= {'image' => TkPhotoImage.new('file'=>image_path + 'btn.adjourn.gif'),
        'balloon'=> "Request your opponent to adjourn the game.
if he accept, the game is stored (see help stored)
and can be reload with the 'reload' command"}
    GUI['GoPlayer.button.done']= {'image' => TkPhotoImage.new('file'=>image_path + 'btn.done.gif'),
        'balloon'=> "press 'done' when you have removed all the dead stones.
this command cannot be undone"}
    GUI['GoPlayer.button.resign']= { 'image' => TkPhotoImage.new('file'=>image_path + 'btn.resign.gif'),
        'balloon'=> "click here if you\nare really desperate",
        'cursor'=> 'pirate'}

    GUI['GoPlayer.button.ok']= { 'image' => TkPhotoImage.new('file'=>image_path + 'btn.ok.gif'),
        'balloon'=>"send the command to the server"}

    GUI['GoPlayer.entry']= {'width'=>2, 'background' => '#b8bbe6',
        'balloon'=>"to close without sending the command,
leave this field empty and press 'ok'"}

    GUI['GoTeacher.top']= {'title' => 'Go Teacher: '}
    GUI['GoTeacher.pane']= {'relief'=>'groove','borderwidth'=>'4'}
    GUI['GoTeacher.title.moves']= { 'text'=>'Moves','fill'=>'white'}

    GUI['GoTeacher.button.begin']= {'image'=> TkPhotoImage.new('file'=> image_path + 'buttons/player_start.gif'),
        'balloon'=>"set a mark at this move"}
    GUI['GoTeacher.button.backward']= {'image'=> TkPhotoImage.new('file'=> image_path + 'buttons/1leftarrow.gif'),
        'balloon'=>"undo one move or until last mark" }
    GUI['GoTeacher.button.forward']= {'image'=> TkPhotoImage.new('file'=> image_path + 'buttons/1rightarrow.gif'),
        'balloon'=>"forward one move" }


    GUI['GoProbs.top']= {'title' => 'Go Problems '}
 GUI['GoProbs.button.previous']= {'image'=> TkPhotoImage.new('file'=> image_path + 'buttons/2leftarrow.gif'),
        'balloon'=>"previous problem" }
 GUI['GoProbs.button.next']= {'image'=> TkPhotoImage.new('file'=> image_path + 'buttons/2rightarrow.gif'),
        'balloon'=>"next problem" }

 GUI['GoProbs.button.backward']= {'image'=> TkPhotoImage.new('file'=> image_path + 'buttons/1leftarrow.gif'),
        'balloon'=>"back 2 moves" }

 GUI['GoProbs.button.begin']= {'image'=> TkPhotoImage.new('file'=> image_path + 'buttons/player_start.gif'),
        'balloon'=>"to the beginning" }



    GUI['GoBasic.canvas']= { 'background'=> 'white','borderwidth'=>4,'relief'=>'raised'}

    GUI['GoClient.top']= {'title' => 'Connect to the server','resizable'=>['false','false']}
    GUI['GoClient.label']= { 'relief'=> 'raised','borderwidth'=>2,'pady'=>2,'foreground'=>'white'}
    GUI['GoClient.label.server']= {'text'=>'server','width'=>10,
        'balloon'=> "The adress can be a name ('igs.joyjoy.net')
as well as an IP adress(210.146.253.13)"}
    GUI['GoClient.label.user']= {'text'=>'user','width'=>10,
        'balloon'=> "Your user name. If you don't have one, choose 'guest'
and when you are connected type 'help register'"}
    GUI['GoClient.label.password']= {'text'=>'password','width'=>10,
        'balloon'=> "Leave this field empty if you choose 'guest'"}
    GUI['GoClient.entry.port']=  {'width' => 4,
        'balloon'=>"The port for the go protocol on the server"}

    GUI['GoClient.button.ok']={'text'=>'OK','borderwidth'=>3}
    GUI['GoClient.button.cancel']={'text'=>'Cancel'}
    GUI['GoClient.button.help']={'text'=>'Help' }



    GUI['get_text.top']= {'title' => 'Enter text:'}


    GUI['Console.top']= { 'title' => 'Console: ' }
    GUI['Console.label.netperf']= {'foreground'=>'yellow','relief'=>'sunken',
#GUI['Console.scrollbar.netperf']= {'orient'=>'horizontal',
        'balloon'=>"Date of the last datas received from the server
(IGS local time)
useful to see if there is netlag
(need quiet mode off)"}
    GUI['Console.label.netlag']= {'balloon'=>'time elapsed while waiting for data'}

#GUI['Console.button.quiet'] = {'image'=> TkPhotoImage.new('file'=> image_path + 'btn.quiet.gif'),
#'balloon'=> "Toggle the 'quiet' option\n(see help quiet')"}

    GUI['Console.button.logout']= {'image'=>Defaults::ICONS['logout'],'balloon'=>"Close the connection with the server"}
    GUI['Console.button.players'] = {'image'=> TkPhotoImage.new('file'=> image_path + 'btn.players.gif'),
        'balloon'=> "Open the players list\n(see help user')"}
    GUI['Console.button.games'] = {'image'=> TkPhotoImage.new('file'=> image_path + 'btn.games.gif'),
        'balloon'=> "Open the games list\n(see help quiet')"}
    GUI['Console.button.reviews'] = {'image'=> TkPhotoImage.new('file'=> image_path + 'btn.quiet.gif'),
        'balloon'=> "Open the reviews list\n(see help review')"}
#GUI['Console.button.help']= {'image'=>Defaults::ICONS['unknown'],'balloon'=>"Help !!!"}
    GUI['Console.image.state']= {'image'=>Defaults::ICONS['ready']}
#,'balloon'=> "The smiley means the server is ready to receive commands
#The red cross means the connection is probably broken"}


    GUI['Console.label.user_state']= {'image'=>Defaults::ICONS['unknown'],'relief'=>'sunken',
        'balloon'=> 'Shows your state on the server:
X: Not accepting matches
V: Accept Matches
!: Looking for a game
?: Unknown' }




    GUI['Dialog.text'] =  { 'width'=> 30,'height'=>10,
        'background'=>'black','foreground'=>'white' ,
        'font'=> $fixed_font,'state'=>'disabled', 'insertbackground' => 'white',
        'wrap'=> 'word'}


#GUI['Dialog.text.GoObserver'] = { 'width'=>30 }
#GUI['Dialog.text.GoPlayer'] = { 'width'=> 30 }
#GUI['Dialog.text.GoReplay'] = { 'width'=> 20 }
#GUI['Dialog.text.GoTeacher'] = { 'width'=> 30}
#GUI['Dialog.text.GnuGo'] = { 'width'=> 30 }
    GUI['Dialog.text.GoEditor'] = { 'state'=>'normal' }
    GUI['Dialog.text.Chat'] = { 'width'=>40,'height'=>10 }
#GUI['Gowin.top']=  { 'geometry'=> '+200+0'}

    GUI['Gowin.frame']= {'relief' => 'ridge','borderwidth'=>3}  
    GUI['Gowin.frame.mid']= {'borderwidth'=>0}  

    GUI['GoReplay.top']= {'title' => 'Replay a game'}

    GUI['GoReplay.pane']= {'relief'=>'groove','borderwidth'=>'4'}

    GUI['GoReplay.pane.navigate'] = {'balloon'=> "You can use left/right arrows keys
combined with 'shift' key instead"}
    GUI['GoReplay.pane.play']= {'balloon'=> "you can use keys:
Enter, Shift-Enter, and space"}

    GUI['GoReplay.pane.variations']= {'balloon'=>"Use Up/Down arrows keys"}

    GUI['GoReplay.frame.variations']= {'width' => 10, 'height'=> 10,'balloon'=>"You can Shift-click on the letter
of a variation on the goban too." }

GUI['GoReplay.button']= { 'takefocus'=>0}
    GUI['GoReplay.button.begin']= {'image'=> TkPhotoImage.new('file'=> image_path + 'buttons/player_start.gif'),
        'balloon'=>"Go to the beginning of the game
(root node)",'state'=>'disabled'}
    GUI['GoReplay.button.fastb']= {'image'=> TkPhotoImage.new('file'=> image_path + 'buttons/2leftarrow.gif'),
        'balloon'=>"Fast backward
(10 moves configurable)" ,'state'=>'disabled'}
    GUI['GoReplay.button.backward']= {'image'=> TkPhotoImage.new('file'=> image_path + 'buttons/1leftarrow.gif'),
        'balloon'=>"back one move" ,'state'=>'disabled'}
    GUI['GoReplay.button.forward']= {'image'=> TkPhotoImage.new('file'=> image_path + 'buttons/1rightarrow.gif'),
        'balloon'=>"forward one move" ,'state'=>'disabled'}
    GUI['GoReplay.button.fastf']= {'image'=> TkPhotoImage.new('file'=> image_path + 'buttons/2rightarrow.gif'),
        'balloon'=>"fast forward
(10 moves configurable)" ,'state'=>'disabled'}
    GUI['GoReplay.button.end']= {'image'=> TkPhotoImage.new('file'=> image_path + 'buttons/player_end.gif'),
        'balloon'=>"Go to the end of the game
(last node - main variation)",'state'=>'disabled'}
    GUI['GoReplay.button.play']= {'image'=> TkPhotoImage.new('file'=> image_path + 'buttons/1rightarrow.gif'),
        'balloon'=>"automatic play 
(one move per second configurable)",'state'=>'normal'}
    GUI['GoReplay.button.play_fast']= {'image'=> TkPhotoImage.new('file'=> image_path + 'buttons/2rightarrow.gif'),
        'balloon'=>"auto-fast play
1/10 s configurable",'state'=>'normal'}
    GUI['GoReplay.button.stop']= {'image'=> TkPhotoImage.new('file'=> image_path + 'buttons/player_stop.gif'),
        'balloon'=>"stop auto-play" ,'state'=>'disabled'}
    GUI['GoReplay.button.varprev']= {'image'=> TkPhotoImage.new('file'=> image_path + 'buttons/1uparrow.gif'),
        'balloon'=>"previous variation" ,'state'=>'disabled'}
    GUI['GoReplay.button.varnext']= {'image'=> TkPhotoImage.new('file'=> image_path + 'buttons/1downarrow.gif'),
        'balloon'=>"next variation" ,'state'=>'disabled'}

    GUI['GoReplay.text'] = { 'height'=> 10, 'width'=>80,'background'=>'black','foreground'=>'white' ,
        'font'=> $fixed_font }

    GUI['GoReplay.title.variations']= { 'text'=>'Variations','fill'=>'white'}
    GUI['GoReplay.title.play']= { 'text'=>'Play','fill'=>'white'}
    GUI['GoReplay.title.navigate']= { 'text'=>'Navigate','fill'=>'white'}
    GUI['GoReplay.scrollbar.navigate']= {'orient'=>'horizontal'}
    GUI['GoReplay.move.navigate'] = {'text'=> '000', 'fill'=> 'white'}

    GUI['browser.top']= {'title'=> 'URL browser', 'resizable' => ['false','false'] }
    GUI['browser.frame']= { 'borderwidth'=>2,'relief'=>'groove' }
    GUI['browser.label.bookmarks']= { 'text'=> 'Bookmarks','balloon'=>'web pages where to find SGF files' }
    GUI['browser.button.add']= { 'text'=> 'Add', 'balloon'=>'Add this address to bookmarks'}
    GUI['browser.button.delete']= { 'text'=> 'Delete', 'balloon'=>'delete selected bookmark' }
    GUI['browser.button.browse']= {'text'=> '>>Browse>>', 'balloon'=>'parse the html page'}
    GUI['browser.label.games']= { 'text'=> 'Games', 'balloon'=>'The games contained in the page' }
    GUI['browser.button.open']=  {'text'=> 'Open', 'balloon'=>'Open this game'}
    GUI['browser.button.cancel']= {'text'=> 'Cancel', 'balloon'=>'Close the window'}

    GUI['browser.list.bookmarks']= {'width'=>50}
    GUI['browser.list.games']= {'width'=>50}

    GUI['Stats.top']= { 'resizable' => ['false','false'] }
    GUI['Stats.frame']= { 'borderwidth'=>2,'relief'=>'groove' }
    GUI['Stats.entry']= { 'width'=>8, 'background'=> 'blue', 'foreground'=>'yellow' }

    GUI['Stats.button.head']={'balloon'=>'Choose a head for that player'}

    GUI['Stats.label.name']= { 'text'=>'Name' }
    GUI['Stats.label.language']= { 'text'=>'Language' }
    GUI['Stats.label.game']= { 'text'=>'Game' }
    GUI['Stats.label.rating']= { 'text'=>'Rating' }
    GUI['Stats.label.rated_games']= { 'text'=>'Rated games' }
    GUI['Stats.label.rank']= { 'text'=>'Rank' }
    GUI['Stats.label.wins']= { 'text'=>'Wins' }
    GUI['Stats.label.losses']= { 'text'=>'Losses' }
    GUI['Stats.label.idle_time']= { 'text'=>'Idle time' }
    GUI['Stats.label.address']= { 'text'=>'Address' }
    GUI['Stats.label.reg_date']= { 'text'=>'Registration date' }
    GUI['Stats.label.playing']= { 'text'=>'Playing in game','foreground'=>'yellow' }
    GUI['Stats.label.info']= { 'text'=>'Info' }
    GUI['Stats.label.defaults']= { 'text'=>'Defaults' }
    GUI['Stats.label.last_access']= { 'text'=>'Last access (GMT)' }
    GUI['Stats.label.last_local']= { 'text'=>'Last access (local)' }
    GUI['Stats.label.not_on']= { 'text'=>'Not on','foreground'=>'yellow' }
    GUI['Stats.label.key']= {'text'=>'Key'}
    GUI['Stats.label.value']= {'text'=>'Value'}


    GUI['Stats.label.notes']=  { 'text'=>'Notes'}
    GUI['Stats.button.close']= { 'text'=>'Close' }
    GUI['Stats.button.help']= { 'text'=> 'Help'}
    GUI['Stats.text.notes']=  { 'width'=>20,'height'=>10}

    GUI['Stats.check.notify']= {'text'=> 'Notify me when connected', 'balloon'=>'Need quiet option off'}
    GUI['Stats.check.decline']= {'text'=> 'Decline match requests', 'balloon'=>'automatic on receive'}

    GUI['sgf_info.top']= {  'title'=>'SGF Info' , 'resizable' => ['false','false']}
    GUI['sgf_info.frame']= { 'borderwidth'=>2,'relief'=>'groove' }
    GUI['sgf_info.text.annot']= { 'height'=>10,'width'=>40 }
    GUI['sgf_info.entry']= { 'width'=>10 }
    GUI['sgf_info.entry.file']= { 'width'=>30 }

    GUI['sgf_info.label.annot']= { 'text'=>'Annotations' }
    GUI['sgf_info.label.Name']= { 'text'=>'Name' }
    GUI['sgf_info.label.Size']= { 'text'=>'Size' }
    GUI['sgf_info.label.Version']= { 'text'=>'SGF Version' }
    GUI['sgf_info.label.Event']= { 'text'=>'Event' }
    GUI['sgf_info.label.Date']= { 'text'=>'Date' }
    GUI['sgf_info.label.Copyright']= { 'text'=>'Copyright' }
    GUI['sgf_info.label.Place']= { 'text'=>'Place' }
    GUI['sgf_info.label.User']= { 'text'=>'User' }
    GUI['sgf_info.label.Source']= { 'text'=>'Source' }
    GUI['sgf_info.label.Comment']= { 'text'=>'Comment' }
    GUI['sgf_info.label.Application']= { 'text'=>'Application' }

    GUI['sgf_info.label.Game']= { 'text'=>'Game' }
    GUI['sgf_info.label.Round']= { 'text'=>'Round' }
    GUI['sgf_info.label.Time']= { 'text'=>'Time', 'balloon'=> 'The time is in seconds' }
    GUI['sgf_info.label.Byo Yomi']= { 'text'=>'Byo Yomi' }
    GUI['sgf_info.label.Handicap']= { 'text'=>'Handicap' }
    GUI['sgf_info.label.Komi']= { 'text'=>'Komi' }
    GUI['sgf_info.label.Rules']= { 'text'=>'Rules' }
    GUI['sgf_info.label.Result']= { 'text'=>'Result' }
    GUI['sgf_info.label.Opening']= { 'text'=>'Opening' }

    GUI['sgf_info.label.name']= { 'text'=>'name' }
    GUI['sgf_info.label.rank']= { 'text'=>'rank' }
    GUI['sgf_info.label.team']= { 'text'=>'team' }
    GUI['sgf_info.label.white']= { 'text'=>'white' }
    GUI['sgf_info.label.black']= { 'text'=>'black' }


    GUI['DiagramPrinter.top']= {'title'=> 'Diagram Printer'}

    GUI['DiagramPrinter.frame.print'] = { 'borderwidth'=>2,'relief'=>'groove' }
    GUI['DiagramPrinter.entry']= {'width'=>40}
    GUI['DiagramPrinter.label.file']={'text'=>'File', 'balloon'=>"The latex source created"}
    GUI['DiagramPrinter.label.mode']={'text'=>'mode' }
    GUI['DiagramPrinter.label.paper']={'text'=>'paper'}
    GUI['DiagramPrinter.label.diagram width']={'text'=>'diagram width', 'balloon'=>"Fraction of the text width"}
    GUI['DiagramPrinter.entry.diagram width']={'width'=> 8}
    GUI['DiagramPrinter.label.latex program']={'text'=>'latex program', 'balloon'=>"command used to produce DVI file from latex source"}
    GUI['DiagramPrinter.label.DVI viewer']={'text'=>'DVI viewer', 'balloon'=>"command for visualize DVI on screen"}
    GUI['DiagramPrinter.label.make Postscript with']={'text'=>'make Postscript with', 'balloon'=>"produce Postscript from DVI"}
    GUI['DiagramPrinter.label.view Postscript with']={'text'=>'view Postscript with', 'balloon'=>"Visualize Postscript file before printing"}
    GUI['DiagramPrinter.label.print command']={'text'=>'print command', 'balloon'=>"Send to printer"}

    GUI['DiagramPrinter.button.float figures']={'text'=>'float figures', 'balloon'=>"Automatic placement of figures"}
    GUI['DiagramPrinter.button.make DVI']={'text'=>'make DVI'}
    GUI['DiagramPrinter.button.view DVI']={'text'=>'view DVI'}
    GUI['DiagramPrinter.button.make Postscript']={'text'=>'make Postscript'}
    GUI['DiagramPrinter.button.view Postscript']={'text'=>'view Postscript'}
    GUI['DiagramPrinter.button.print Postscript']={'text'=>'print Postscript'}


    GUI['DiagramPrinter.button.add']= {'text'=>'Add to list', 'balloon'=>"Add the current node with text"}
    GUI['DiagramPrinter.button.make']= {'text'=>'Make output', 'balloon'=>"Perform actions selected"}
    GUI['DiagramPrinter.button.close']= {'text'=>'Close'}



    GUI['GoEditor.top']= {'title' => 'Go Editor'}
#GUI['']={'text'=>''}
    GUI['GoEditor.label.new.Columns']={'text'=>'Columms'}
    GUI['GoEditor.label.new.Rows']={'text'=>'Rows'}
    GUI['GoEditor.button.new.ok']={'text'=>'OK','borderwidth'=>3}
    GUI['GoEditor.button.new.cancel']={'text'=>'Cancel'}

 GUI['Reviews.top']=  { 'title' => 'Reviews','resizable'=> ['false','true'],
        'relief' => 'ridge','borderwidth'=>3}
    GUI['Reviews.button.reload'] = {'image'=> TkPhotoImage.new('file'=> image_path + 'reload3.gif'),
        'balloon'=> "Refresh the list\nfrom the server"}

    GUI['Players.top']=  { 'title' => 'Players','resizable'=> ['false','true'],
        'relief' => 'ridge','borderwidth'=>3}
    GUI['Players.label.info']= {'foreground'=> 'yellow','relief'=>'sunken','balloon'=> "The number of games and players actually on the server.
It is refreshed at the end of the receiving of the list"}

    GUI['Players.button.reload'] = {'image'=> TkPhotoImage.new('file'=> image_path + 'reload3.gif'),
        'balloon'=> "Refresh the list\nfrom the server"}

    GUI['Players.frame']= { 'relief' => 'groove', 'borderwidth'=>4}
    GUI['Players.frame.sort']= {  'balloon'=> "Choose what you want to display
'all' is more time expensive" }
    GUI['Players.frame.filter']= {  'balloon'=> "filter some players"}

    GUI['Players.check.all']= {'text'=> 'all','anchor'=>'w'}
    GUI['Players.check.country']=  {'text'=> 'by country','anchor'=>'w'}
    GUI['Players.check.rank']= {'text'=> 'by rank','anchor'=>'w'}

    GUI['Players.entry.country']= {'foreground'=>'yellow','width'=>3}
    GUI['Players.entry.rank1']= {'foreground'=>'white','width'=>3}
    GUI['Players.entry.rank2']= {'foreground'=>'white','width'=>3}

    GUI['Players.check.new']= {'text'=> 'New','anchor'=>'w'}
    GUI['Players.check.closed']=  {'text'=> 'Closed','anchor'=>'w'}
    GUI['Players.check.playing']= {'text'=> 'Playing','anchor'=>'w'}





    GUI['Games.top']= { 'title' => 'Games','resizable'=> ['false','true'],
        'relief' => 'ridge','borderwidth'=>3}
    GUI['Games.label']=  {'foreground'=> 'yellow','borderwidth'=>1, 'relief'=> 'sunken' }
    GUI['Games.button.reload'] = {'image'=> TkPhotoImage.new('file'=> image_path + 'reload3.gif'),
        'balloon'=> "Refresh the list\nfrom the server"}
#GUI['Games.button.quiet'] = {'image'=> TkPhotoImage.new('file'=> image_path + 'btn.quiet.gif'),
#'balloon'=> "Toggle the 'quiet' option\n(see help quiet')"}


    GUI['GoMatch.top']= { 'borderwidth'=>4,'relief'=> 'ridge','title'=>'Match','resizable'=> ['false','false']}
    GUI['GoMatch.label']= {'borderwidth'=>2, 'relief'=> 'raised','padx'=>5 , 'pady'=>2 ,'anchor'=>'e'}
    GUI['GoMatch.label.title']= {'balloon'=> 'Play a game with that player' }
    GUI['GoMatch.label.color']= {'balloon'=> 'Choose W(hite) or B(lack)' }
    GUI['GoMatch.label.size']= { 'text'=>'size:','balloon'=> "Size of the board
are usually 19, 13, 11 or 9
(see help goboard)" }
    GUI['GoMatch.label.time']= {'text'=>'time:','balloon'=> "Absolute time (in minutes)" }
    GUI['GoMatch.label.byo']= {'text'=>'byo-yomi:','balloon'=> "Maximum time (in minutes) in which
the number of byo-stones must be played"  }
    GUI['GoMatch.label.byo_stones']= {'text'=>'byo-stones:','balloon'=> "this number can be changed only using automatch
see help automatch"}

    GUI['GoMatch.entry']= { 'width'=>2 }
    GUI['GoMatch.entry.komi']= {'state'=>'disabled', 'width'=>3 }
    GUI['GoMatch.entry.byo_stones']= {'state'=>'disabled', 'relief'=> 'solid' }
    GUI['GoMatch.checkbutton']=GUI['GoMatch.label']
    GUI['GoMatch.checkbutton.message']={'text'=>'send message','balloon'=>"send this message to the player
when sending the match request",'relief'=>'flat'}
    GUI['GoMatch.checkbutton.set_free']={'text'=>'free game','balloon'=>"The game will not count for ratings" ,'relief'=>'flat'}
    GUI['GoMatch.checkbutton.set_komi']= {'text'=>'set komi to:','balloon'=> "change the komi after the game is started",'relief'=>'flat'}
    GUI['GoMatch.button.decline']={'text'=>'decline'}
    GUI['GoMatch.button.help']={'text'=>'help'}



    GUI['GoSetup.top']= { 'title' => 'Setup'}

    GUI['new_goban.top']= { 'borderwidth'=>2,'relief'=>'groove', 'resizable' => ['false','false']}
    GUI['gg_new_game.top']= { 'borderwidth'=>2,'relief'=>'groove', 'resizable' => ['false','false']}



    GUI['IGSList.frame']= { 'borderwidth'=>2,'relief'=>'groove' }
    GUI['IGSList.frame.main']= { 'borderwidth'=>0 }
    GUI['IGSList.canvas']= { 'borderwidth'=>2,'relief'=>'groove' }
#GUI['IGSList.canvas.titlebar']=  { 'height'=> 50 }

#@balloon_font= (if $platform == 'windows'; TkFont.new('Fixedsys'); else TkFont.new('fixed'); end)

    GUI['tkballoon.label']= { 'background'=>'yellow','justify'=>'left','font'=> $fixed_font}

    GUI['GoScore.top']= { 'title'=>'Score game'}
    GUI['VirtualText.text']= {'fill'=>'yellow','anchor'=>'nw','tags'=>'Over'}

    GUI['info.top']= {'title'=> 'Info','resizable'=> ['false','false']}
    GUI['info.text']= { 'background'=>'white','relief'=> 'ridge','borderwidth'=> 4}
    GUI['message.text']= { 'background'=>'white','relief'=> 'raised','borderwidth'=> 4}

    GUI['info.button.close']= { 'text'=> 'close'}
    
    GUI['GnuGo.top']= {'title' =>  'GnuGo Player '}
    GUI['GnuGo.label.new.Columns']= {'text'=> 'size:'}
    GUI['GnuGo.label.new.komi']= {'text'=> 'komi:'}
    GUI['GnuGo.label.new.handi']= {'text'=> 'handicap:'}
    GUI['GnuGo.label.new.level']= {'text'=> 'level:'}
    GUI['GnuGo.label.new.gg_cmd']= {'text'=> 'command:'}
    GUI['GnuGo.button.new.ok']= {'text'=> 'ok'}
    GUI['GnuGo.button.new.cancel']= {'text'=> 'cancel'}

    GUI['GnuGo.choose']= {'relief'=>'ridge', 'borderwidth'=> 2}
    GUI['GnuGo.label.white']= {'text'=> 'White'}
    GUI['GnuGo.label.black']= {'text'=> 'Black'}
    GUI['GnuGo.radio.human']= {'text'=> 'Human','anchor'=>'w'}
    GUI['GnuGo.radio.gnugo']= {'text'=> 'GnuGo','anchor'=>'w'}
    GUI['GnuGo.button.undo']= {'image' => TkPhotoImage.new('file'=>image_path + 'btn.undo.gif'),
        'balloon' => "undo the last move"}
    GUI['GnuGo.button.pass']= {'image' => TkPhotoImage.new('file'=>image_path + 'btn.pass.gif'),
        'balloon'=> "there is no game end with GnuGo"}
    GUI['GnuGo.button.done']= {'image' => TkPhotoImage.new('file'=>image_path + 'btn.done.gif'),
        'balloon'=> "ask GnuGo for the score of the game"}

    GUI['GnuGo.check.beginner']= {'text'=> 'Beginner','balloon'=> 'Show liberties and groups of stones'}

    GUI['ViewSgf.top']= { 'title'=>'Sgf source' }
	GUI['ViewSgf.text']= { 'background'=>'white' }

#GUI['menu'] options by default for all menus - define it if needed

#GUI['CmdLine']

GUI['Wlist.top']= { 'title' => 'Server listings','resizable'=> ['false','true']}


    MENU=Hash.new

    TR=Hash.new

TR['warning.restart.C']= 'You must restart RubyGo to make the change take effect'
TR['warning.restart.fr']= "Vous devez redémarrer RubyGo pour que le changement prenne effet."
TR['warning.restart.it']= "Dovete rilanciare RubyGo per attivare il cambiamento effettuato"

# indices en caractères
#Name        Info            Country  Rank Won/Lost Obs  Pl Idle Flags Language
#11 KEnn 1 0 1 susu-KEnn(B) IGS
#[##]  white name [ rk ]      black name [ rk ] (Move size H Komi BY FR) (###)
    Titlebar= Hash.new
    Titlebar['Players']= ['','Rank','Name','','Info','Idle','Country','Won','Lost','Obs','Play']
    Titlebar['User']= ['Name','Info' ,'Country', 'Rank', 'Won','Lost', 'Obs',  'Pl', 'Idle', 'Flags']
    Titlebar['Games']= ['Nb','White','Rank','Black','Rank','Move','Size','H','Komi','Byo','F','R','Obs']
	Titlebar['Reviews']= ['Nb', 'owner', 'x', 'x', 'x', 'title', 'place']
	Titlesize= Hash.new
#	Titlesize['Reviews']= [10, 50, 140, 150, 160, 190, 340]
	Titlesize['Reviews']= [1,7 ,19 ,21 ,23 ,26 ,52 ]
#	Titlesize['Players']=[1,30,65,145,170,280,310,360,410,450,480]
	Titlesize['User']=[1,16,32,42,48,54,61,66,71,76]
 	Titlesize['Games'] = [1,7,22,28,43,51,57,62,65,70,75,77,80]

    $language= Defaults.get_default_value('language')
    if $language.value != 'C'
      user_lang= File.join($current_path,'TkDefaults.' + $language.value )
      if test(?r,user_lang)
        load user_lang
      else
        $stderr.puts "user language not found: " + user_lang
      end
    end


    user_gui=File.join($home,'TkDefaults.rb')
    if test(?r,user_gui)
      load user_gui
      $stderr.puts "user GUI loaded"
    else
      $stderr.puts "user GUI not found"
    end


end

