put Find/Replac And ToolsPanel To bottom left of the IDE

Working on new editor enhancements?
User avatar
gurj
Enthusiast
Enthusiast
Posts: 658
Joined: Thu Jan 22, 2009 3:48 am
Location: china
Contact:

put Find/Replac And ToolsPanel To bottom left of the IDE

Post by gurj »

Code: Select all

;put Find/Replac And ToolsPanel To the bottom left of the IDE
Global show,add
Enumeration FormWindow
 #Window_0
 #Window_1
EndEnumeration
Enumeration FormGadget
 #Panel_0
 #Scintilla_0
 
 #toLog
 #toFind
 #tools
 ;{tool
 #log
 #find
 #tool0
 #tool1
 #tool2
 #tool3
 #tool4
 #tool5
 #tool6
 ;}
 ;#addG
EndEnumeration
add=#Log-#toLog
Procedure OpenWindow_0(x = 120, y = 50, width = 735, height = 587)
 win0=OpenWindow(#Window_0, x, y, width, height, "PureBasic", #PB_Window_SystemMenu)
 If CreateMenu(0, Win0)
  MenuTitle("&File")
  MenuItem(1, "Open"   +Chr(9)+"Ctrl+O")
  MenuItem(2, "Save"   +Chr(9)+"Ctrl+S")
  MenuItem(3, "Save as"+Chr(9)+"Ctrl+A")
  MenuItem(4, "Close"  +Chr(9)+"Ctrl+C")
 EndIf
 If CreateToolBar(0, Win0)
  ToolBarStandardButton(1, #PB_ToolBarIcon_New)
  ToolBarStandardButton(2, #PB_ToolBarIcon_Open)
  ToolBarStandardButton(3, #PB_ToolBarIcon_Save)
 EndIf
 If CreateStatusBar(0, Win0)
  AddStatusBarField(200)
  StatusBarText(0, 0, "1:1[0]");line:column[selected]
  AddStatusBarField(1000)
 EndIf
 
 top=ToolBarHeight(0)
 area=height-MenuHeight()-StatusBarHeight(0)
 LogHeight=124
 logY=area-LogHeight
 
 PanelGadget(#Panel_0, 0, top, width, logY-top)
 AddGadgetItem(#Panel_0, -1, "Tab 1")
 If InitScintilla()
  ScintillaGadget(#Scintilla_0, 0, 0, width,
                  logY-top-GetGadgetAttribute(#Panel_0,#PB_Panel_TabHeight), 0)
 EndIf
 CloseGadgetList()
 ButtonGadget(#toLog, 0, logY, 38, 20, "log")
 ButtonGadget(#toFind, 38, logY, 95, 20, "Find/Replac")
 ListViewGadget(#tools, 0, logY+20, 133, LogHeight-20)
 Dim tool.s(6)
 tool(n)="Procedure Browser":n+1
 tool(n)="Code Templates":n+1
 tool(n)="Form Panel":n+1
 tool(n)="Character Table":n+1
 tool(n)="Explorer":n+1
 tool(n)="Project Panel":n+1
 tool(n)="Color Picker":n+1
 For n=0 To 6
  AddGadgetItem(#tools,-1,tool(n))
 Next
 toolWidth=width-133
 ListViewGadget(#log, 133, logY,toolWidth , LogHeight)
 AddGadgetItem(#log,-1,"log_welcome!")
 show=#log
 ContainerGadget(#find, 133, logY, toolWidth, LogHeight)
CheckBoxGadget(100,5,1,128,21,"Case Sensitive")
ComboBoxGadget(101,139,1,368,21,#PB_ComboBox_Editable)
CheckBoxGadget(102,5,22,128,21,"Replace with: ")
ComboBoxGadget(103,139,22,368,21,#PB_ComboBox_Editable)
CheckBoxGadget(104,5,43,243,21,"Whole Words only")
CheckBoxGadget(105,261,43,229,21,"Don't search in Comments")
CheckBoxGadget(107,5,64,243,21,"Search inside Selection only")
CheckBoxGadget(106,261,64,229,21,"Don't search in Strings")
ButtonGadget(108,10,88,119,24,"Find previous")
ButtonGadget(109,139,88,89,24,"Find Next")
ButtonGadget(110,233,88,76,24,"Replace")
ButtonGadget(111,314,88,101,24,"Replace All")
;ButtonGadget(112,435,88,56,24,"Close")
CloseGadgetList()
 HideGadget(#find,1)
 For n=0 To 6
  TextGadget(#tool0+n, 133, logY, toolWidth, LogHeight,"</:\>"+tool(n))
  HideGadget(#tool0+n,1)
 Next
EndProcedure
Procedure Window_0_Events()
 Repeat
  event=WaitWindowEvent()
  Select event
   Case #PB_Event_Menu
    Select EventMenu()
    EndSelect
   Case #PB_Event_Gadget
    evG=EventGadget()
    Select evG
     Case #toLog,#toFind
      HideGadget(show,1)
      show=evG+add
      HideGadget(show,0)
     Case #tools
      tool=GetGadgetState(evG)+#tool0
      
      HideGadget(show,1)
      HideGadget(tool,0)
      show=tool
      
    EndSelect
   Case #PB_Event_CloseWindow
    ProcedureReturn #False
  EndSelect
 ForEver
 ProcedureReturn #True
EndProcedure
OpenWindow_0()
Window_0_Events()
my pb for chinese:
http://ataorj.ys168.com