Debug mode corrected

Active Window wasn't anymore when console opened
This commit is contained in:
djes
2018-03-17 14:36:44 +01:00
parent 648c9c9a4a
commit 55bc5c8f78
3 changed files with 23 additions and 16 deletions

View File

@@ -204,11 +204,11 @@ If OpenWindow(#Window_0, 260, 225, 720, 595, "PBMap", #PB_Window_SystemMenu | #P
SetActiveGadget(#StringGeoLocationQuery)
; Our main gadget
PBMap::MapGadget(#Map, 10, 10, 512, 512)
PBMap::MapGadget(#Map, 10, 10, 512, 512, 1, #Window_0)
PBMap::SetOption(#Map, "ShowDegrees", "1") : Degrees = 0
PBMap::SetOption(#Map, "ShowDebugInfos", "1")
PBMap::SetDebugLevel(5)
PBMap::SetOption(#Map, "Verbose", "0")
PBMap::SetOption(#Map, "Verbose", "1")
PBMap::SetOption(#Map, "ShowScale", "1")
PBMap::SetOption(#Map, "Warning", "1")
PBMap::SetOption(#Map, "ShowMarkersLegend", "1")
@@ -239,11 +239,11 @@ If OpenWindow(#Window_0, 260, 225, 720, 595, "PBMap", #PB_Window_SystemMenu | #P
StringGadget(#Map2_StringLongitude, 580, 210, 90, 20, "")
; Our second map:
PBMap::MapGadget(#Map2_Canvas, 10, 10, 512, 512)
PBMap::MapGadget(#Map2_Canvas, 10, 10, 512, 512, 1, #Window_0)
PBMap::SetOption(#Map2_Canvas, "ShowDegrees", "1") : Degrees = 0
PBMap::SetOption(#Map2_Canvas, "ShowDebugInfos", "1")
PBMap::SetDebugLevel(5)
PBMap::SetOption(#Map2_Canvas, "Verbose", "0")
PBMap::SetOption(#Map2_Canvas, "Verbose", "1")
PBMap::SetOption(#Map2_Canvas, "ShowScale", "1")
PBMap::SetOption(#Map2_Canvas, "Warning", "1")
PBMap::SetOption(#Map2_Canvas, "ShowMarkersLegend", "1")
@@ -361,8 +361,8 @@ If OpenWindow(#Window_0, 260, 225, 720, 595, "PBMap", #PB_Window_SystemMenu | #P
PBMap::FreeMapGadget(#Map2_Canvas)
EndIf
; IDE Options = PureBasic 5.61 (Windows - x64)
; CursorPosition = 204
; FirstLine = 176
; CursorPosition = 241
; FirstLine = 198
; Folding = --
; EnableThread
; EnableXP

View File

@@ -83,14 +83,14 @@ DeclareModule PBMap
Declare DisableLayer(MapGadget.i, Name.s)
Declare SetLayerAlpha(MapGadget.i, Name.s, Alpha.d)
Declare.d GetLayerAlpha(MapGadget.i, Name.s)
Declare BindMapGadget(MapGadget.i, TimerNB = 1)
Declare BindMapGadget(MapGadget.i, TimerNB = 1, Window = -1)
Declare SetCallBackLocation(MapGadget.i, *CallBackLocation)
Declare SetCallBackMainPointer(MapGadget.i, CallBackMainPointer.i)
Declare SetCallBackDrawTile(MapGadget.i, *CallBackLocation)
Declare SetCallBackMarker(MapGadget.i, *CallBackLocation)
Declare SetCallBackLeftClic(MapGadget.i, *CallBackLocation)
Declare SetCallBackModifyTileFile(MapGadget.i, *CallBackLocation)
Declare.i MapGadget(MapGadget.i, X.i, Y.i, Width.i, Height.i, TimerNB = 1) ; Returns Gadget NB if #PB_Any is used for gadget
Declare.i MapGadget(MapGadget.i, X.i, Y.i, Width.i, Height.i, TimerNB = 1, Window = -1) ; Returns Gadget NB if #PB_Any is used for gadget
Declare FreeMapGadget(MapGadget.i)
Declare.d GetLatitude(MapGadget.i)
Declare.d GetLongitude(MapGadget.i)
@@ -2701,12 +2701,15 @@ Module PBMap
EndProcedure
; Could be called directly to attach our map to an existing canvas
Procedure BindMapGadget(MapGadget.i, TimerNB = 1)
Procedure BindMapGadget(MapGadget.i, TimerNB = 1, Window = -1)
Protected *PBMap.PBMap
*PBMap.PBMap = AllocateStructure(PBMap)
If *PBMap = 0
FatalError(MapGadget, "Cannot initialize PBMap memory")
EndIf
If Window = -1
Window = GetActiveWindow()
EndIf
PBMaps(Str(MapGadget)) = *PBMap
With *PBMap
Protected Result.i
@@ -2718,7 +2721,7 @@ Module PBMap
\EditMarker = #False
\StandardFont = LoadFont(#PB_Any, "Arial", 20, #PB_Font_Bold)
\UnderlineFont = LoadFont(#PB_Any, "Arial", 20, #PB_Font_Underline)
\Window = GetActiveWindow()
\Window = Window
\Timer = TimerNB
\Mode = #MODE_DEFAULT
\MemoryCacheAccessMutex = CreateMutex()
@@ -2739,15 +2742,18 @@ Module PBMap
EndProcedure
; Creates a canvas and attach our map
Procedure MapGadget(MapGadget.i, X.i, Y.i, Width.i, Height.i, TimerNB = 1)
Procedure MapGadget(MapGadget.i, X.i, Y.i, Width.i, Height.i, TimerNB = 1, Window.i = -1)
If Window = -1
Window = GetActiveWindow()
EndIf
If MapGadget = #PB_Any
Protected GadgetNB.i
GadgetNB = CanvasGadget(#PB_Any, X, Y, Width, Height, #PB_Canvas_Keyboard) ; #PB_Canvas_Keyboard has to be set for mousewheel to work on windows
BindMapGadget(GadgetNB, TimerNB)
BindMapGadget(GadgetNB, TimerNB, Window)
ProcedureReturn GadgetNB
Else
If CanvasGadget(MapGadget, X, Y, Width, Height, #PB_Canvas_Keyboard)
BindMapGadget(MapGadget, TimerNB)
BindMapGadget(MapGadget, TimerNB, Window)
Else
FatalError(MapGadget, "Cannot create the map gadget")
EndIf
@@ -3136,8 +3142,8 @@ CompilerEndIf
; IDE Options = PureBasic 5.61 (Windows - x64)
; CursorPosition = 340
; FirstLine = 76
; CursorPosition = 2751
; FirstLine = 2744
; Folding = ---------------------
; EnableThread
; EnableXP

View File

@@ -6,7 +6,7 @@ To develop tiled map applications in PureBasic.
Based on OpenStreetMap services
OSM copyright : http://www.openstreetmap.org/copyright
This code is free !
This code is free, but any use should mention the origin of this code.
Officials forums topics here :
http://www.purebasic.fr/english/viewtopic.php?f=27&t=66320 (english)
@@ -18,3 +18,4 @@ djes
Idle
Progi1984
yves86
Andr<EFBFBD>