2 # GemRB - Infinity Engine Emulator
3 # Copyright (C) 2003 The GemRB Project
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 # GUIMA.py - scripts to control map windows from GUIMA and GUIWMAP winpacks
23 ###################################################
27 import GUICommonWindows
28 from GUIDefines
import *
35 ###################################################
39 if GUICommon
.CloseOtherWindow (OpenMapWindow
):
41 if WorldMapWindow
: OpenWorldMapWindowInside ()
46 GemRB
.SetVar ("OtherWindow", -1)
52 GemRB
.LoadWindowPack ("GUIMA")
53 MapWindow
= Window
= GemRB
.LoadWindow (3)
54 GemRB
.SetVar ("OtherWindow", MapWindow
.ID
)
57 Button
= Window
.GetControl (0)
58 Button
.SetText (20429)
59 Button
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, OpenWorldMapWindow
)
62 Button
= Window
.GetControl (1)
64 Button
.SetVarAssoc ("x", IE_GUI_MAP_SET_NOTE
)
67 Text
= Window
.GetControl (4)
70 Edit
= Window
.CreateTextEdit (6, 0, 0, 200, 100, "FONTDLG", " ")
73 # ronote and usernote are the pins for the notes
74 # 4 is the Label's control ID
75 Window
.CreateMapControl (3, 24, 23, 480, 360, 4, "USERNOTE","RONOTE")
76 Map
= Window
.GetControl (3)
77 GemRB
.SetVar ("x",IE_GUI_MAP_VIEW_NOTES
)
78 Map
.SetVarAssoc ("x", IE_GUI_MAP_VIEW_NOTES
)
80 Map
.SetEvent (IE_GUI_MAP_ON_PRESS
, SetMapNote
)
82 MapTable
= GemRB
.LoadTable( "MAPNAME" )
83 MapName
= MapTable
.GetValue (GemRB
.GetCurrentArea (), "STRING")
85 Label
= Window
.GetControl (0x10000005)
86 Label
.SetText (MapName
)
87 #Label.SetTextColor (255, 0, 0)
93 Button
= Window
.GetControl (5)
95 Button
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, OpenMapWindow
)
96 Button
.SetFlags (IE_GUI_BUTTON_DEFAULT
, OP_OR
)
101 Label
= MapWindow
.GetControl (6)
102 Text
= Label
.QueryText ()
103 GemRB
.SetMapnote (PosX
, PosY
, 0, Text
)
109 Label
= MapWindow
.GetControl (6)
110 Label
.SetEvent (IE_GUI_EDIT_ON_CHANGE
, NoteChanged
)
111 PosX
= GemRB
.GetVar("MapControlX")
112 PosY
= GemRB
.GetVar("MapControlY")
113 Label
.SetStatus (IE_GUI_CONTROL_FOCUSED
)
114 Map
= MapWindow
.GetControl (3)
115 GemRB
.SetVar ("x",IE_GUI_MAP_VIEW_NOTES
)
116 Map
.SetVarAssoc ("x", IE_GUI_MAP_VIEW_NOTES
)
119 def OpenWorldMapWindowInside ():
120 WorldMapWindowCommon (-1)
123 def OpenWorldMapWindow ():
124 WorldMapWindowCommon (GemRB
.GetVar ("Travel"))
127 def WorldMapWindowCommon (Travel
):
128 global WorldMapWindow
134 WorldMapWindow
.Unload ()
135 WorldMapWindow
= None
136 GemRB
.SetVar ("OtherWindow", -1)
137 GUICommonWindows
.EnableAnimatedWindows ()
141 GUICommonWindows
.DisableAnimatedWindows ()
142 GemRB
.LoadWindowPack ("GUIWMAP")
143 WorldMapWindow
= Window
= GemRB
.LoadWindow (0)
145 GemRB
.SetVar ("OtherWindow", WorldMapWindow
.ID
)
147 Window
.CreateWorldMapControl (4, 0, 62, 640, 418, Travel
, "FONTDLG")
148 WMap
= Window
.GetControl (4)
149 WMap
.SetTextColor (IE_GUI_WMAP_COLOR_NORMAL
, 0x20, 0x20, 0x00, 0xff)
150 WMap
.SetTextColor (IE_GUI_WMAP_COLOR_SELECTED
, 0x20, 0x20, 0x00, 0xff)
151 WMap
.SetTextColor (IE_GUI_WMAP_COLOR_NOTVISITED
, 0x20, 0x20, 0x00, 0xa0)
152 WMap
.SetAnimation ("WMPTY")
155 Button
= Window
.GetControl (0)
156 Button
.SetText (1403)
158 Button
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, OpenWorldMapWindow
)
160 Button
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, OpenMapWindow
)
163 ###################################################
164 # End of file GUIMA.py