⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 foption.class

📁 Gambas is a graphical development environment based on a Basic interpreter, like Visual Basic. It us
💻 CLASS
字号:
' Gambas class fileSTATIC PRIVATE $cTheme AS NEW Object[]STATIC PRIVATE $iTheme AS IntegerSTATIC PROPERTY READ DefaultTheme AS Integer[]STATIC PUBLIC SUB _init()  $cTheme.Resize(5)  $cTheme[0] = NEW Integer[]  $cTheme[0].Resize(FEditor.NBR_COLOR)  $cTheme[0][0] = Color.White ' Background  $cTheme[0][1] = Color.Black ' Normal text  $cTheme[0][2] = &80FF& ' Keywords  $cTheme[0][3] = Color.Blue ' Subroutines  $cTheme[0][4] = Color.Blue ' Operators  $cTheme[0][5] = Color.Black ' Symbols  $cTheme[0][6] = Color.Red ' Numbers  $cTheme[0][7] = Color.Magenta ' Strings  $cTheme[0][8] = Color.Gray ' Comments  $cTheme[0][9] = &D00000& ' Breakpoints  $cTheme[0][10] = &80FF& ' Current line  $cTheme[0][11] = &80FF& ' Data types  $cTheme[0][12] = &C0C0FF ' Selection  $cTheme[0][13] = &FFFF00 ' Highlight  $cTheme[0][14] = &E8E8F8 ' Editing line  $cTheme[1] = NEW Integer[]  $cTheme[1].Resize(FEditor.NBR_COLOR)  $cTheme[1][0] = Color.Black ' Background  $cTheme[1][1] = Color.White ' Normal text  $cTheme[1][2] = Color.Yellow ' Keywords  $cTheme[1][3] = Color.Yellow ' Subroutines  $cTheme[1][4] = Color.Yellow ' Operators  $cTheme[1][5] = Color.White ' Symbols  $cTheme[1][6] = Color.Cyan ' Numbers  $cTheme[1][7] = Color.Green ' Strings  $cTheme[1][8] = &C0C0C0& ' Comments  $cTheme[1][9] = Color.Red ' Breakpoints  $cTheme[1][10] = Color.Yellow ' Current line  $cTheme[1][11] = Color.Orange ' Data types  $cTheme[1][12] = &808080 ' Selection  $cTheme[1][13] = &8080FF ' Highlight  $cTheme[1][14] = &303030 ' Highlight  $cTheme[2] = NEW Integer[]  $cTheme[2].Resize(FEditor.NBR_COLOR)  $cTheme[2][0] = &FFFFFF&  $cTheme[2][1] = Color.Black  $cTheme[2][2] = &00C0A0&  $cTheme[2][3] = &00C000&  $cTheme[2][4] = &00C000&  $cTheme[2][5] = &000000&  $cTheme[2][6] = Color.Red  $cTheme[2][7] = &FFAA00&  $cTheme[2][8] = &805500&  $cTheme[2][9] = &D02000&  $cTheme[2][10] = &00C0A0&  $cTheme[2][11] = &00C0A0&  $cTheme[2][12] = &C0FFC0&  $cTheme[2][13] = &FFC0FF&  $cTheme[2][14] = &ECFFE0&  $cTheme[3] = NEW Integer[]  $cTheme[3].Resize(FEditor.NBR_COLOR)  $cTheme[3][0] = &FFFFFF&  $cTheme[3][1] = &000000&  $cTheme[3][2] = &0006FF&  $cTheme[3][3] = &000066&  $cTheme[3][4] = &000066&  $cTheme[3][5] = &000066&  $cTheme[3][6] = &000000&  $cTheme[3][7] = &558888&  $cTheme[3][8] = &008800&  $cTheme[3][9] = &AA0000&  $cTheme[3][10] = &5500FF&  $cTheme[3][11] = &000066&  $cTheme[3][12] = &9DA2CC&  $cTheme[3][13] = &558888&  $cTheme[3][14] = &E0F0FF&  $cTheme[4] = NEW Integer[]  $cTheme[4].Resize(FEditor.NBR_COLOR)  $cTheme[4][0] = &FFFFFF&  $cTheme[4][1] = &000000&  $cTheme[4][2] = &FF0000&  $cTheme[4][3] = &C00000&  $cTheme[4][4] = &C00000&  $cTheme[4][5] = &000000&  $cTheme[4][6] = &8000C0&  $cTheme[4][7] = &FF00FF&  $cTheme[4][8] = &FF8000&  $cTheme[4][9] = &D02000&  $cTheme[4][10] = &BF0060&  $cTheme[4][11] = &FF0000&  $cTheme[4][12] = &FFC0C0&  $cTheme[4][13] = &AAFFC9&  $cTheme[4][14] = &FFE0E0&ENDSTATIC PRIVATE FUNCTION DefaultTheme_Read() AS Integer[]  RETURN $cTheme[0]ENDSTATIC PUBLIC SUB Run()  FOption.ShowModalENDPUBLIC SUB _new()  DIM hCtrl AS Object  cmbTheme.List = [ ("Select a theme..."), ("Bright"), ("Dark"), ("Emerald"), ("Visual"), ("Ruby") ].Join("\n")  edtEditor.Text = "' Gambas class file\n\n"    "PRIVATE CONST aString AS String = \"Gambas almost means Basic\"\n"    "PRIVATE CONST aNumber AS Integer = &H4A177BA5\n\n"    "PUBLIC SUB Main()\n\n"    "  DIM i AS Integer\n\n"    "  PRINT \"User is \"; System.User\n"    "  PRINT \"Today is \"; Date(Now)\n\n"    "  FOR i = 0 TO Application.Args.Count - 1\n"    "    PRINT Application.Args[i]\n"    "  NEXT\n\n"    "  Message(\"Pi / 2 = \" & CStr(Pi(0.5)))\n\n"    "END\n"  edtEditor.Lines.SetFlag(13, GambasEditor.Breakpoint, TRUE)  edtEditor.Lines.SetFlag(9, GambasEditor.Current, TRUE)  edtEditor.Visible = TRUE  SetFont(Font[Settings["/Editor/Font", Project.DEFAULT_FONT]])  FOR EACH hCtrl IN svwColor.Children    IF hCtrl.Tag THEN      SetColor(hCtrl, Val(Settings["/Editor/Color[" & hCtrl.Tag & "]", "-1"]))    ENDIF  NEXT  chkShowMascot.Value = Settings["/ShowMascot", TRUE]  chkShowTooltip.Value = Settings["/ShowTooltip", TRUE]  chkShowCompletion.Value = Settings["/ShowCompletion", TRUE]  'chkShowTip.Value = Project.Config.ReadBoolean("/ShowTipOnStartup", TRUE)  txtHandle.Value = Settings["/HandleSize", 8]  txtIcon.Value = Settings["/Toolbar/IconSize", 32]  chkAnimate.Value = Settings["/Toolbar/Animate", TRUE]  chkEditorToolbar.Value = Settings["/Editor/Toolbar", TRUE]  chkClean.Value = Settings["/Editor/CleanOnSave", FALSE]  chkShowProc.Value = Settings["/Editor/ShowProc", TRUE]  chkShowChange.Value = Settings["/Editor/ShowChange", TRUE]  chkShowCurrent.Value = Settings["/Editor/ShowCurrent", TRUE]  chkUseRelief.Value = Settings["/Editor/UseRelief", TRUE]  txtGrid.Value = Settings["/DefaultGridResolution", 8]  txtTabSize.Value = Settings["/DefaultTabSize", 2]  chkSmallFont.Value = Settings["/UseSmallFont", FALSE]  chkDisplayForm.Value = Settings["/DisplayForm", FALSE]  'chkShowProc_Click  'chkShowCurrent_Click  'chkUseRelief_Click  'chkShowChange_ClickENDPUBLIC SUB btnCancel_Click()  ME.Close(TRUE)ENDPRIVATE SUB SetColor(hCtrl AS Control, iColor AS Integer, OPTIONAL bNoRefresh AS Boolean)  DIM iIndex AS Integer  iIndex = Val(hCtrl.Tag)  IF iColor < 0 THEN    iColor = $cTheme[$iTheme][iIndex]  ENDIF  hCtrl.Background = iColor  edtEditor.Colors[iIndex] = iColor  IF NOT bNoRefresh THEN RefreshEditorENDPUBLIC SUB btnOK_Click()  IF DoApply() THEN RETURN  ME.CloseENDPUBLIC SUB lblColor_MouseDown()  LAST.Border = Border.SunkenENDPUBLIC SUB lblColor_MouseUp()  DIM hCtrl AS Label  hCtrl = LAST  hCtrl.Border = Border.Raised  IF Mouse.X >= 0 AND Mouse.Y >= 0 AND Mouse.X < hCtrl.W AND Mouse.Y < hCtrl.H THEN    Dialog.Color = hCtrl.Background    IF Dialog.SelectColor() THEN RETURN    SetColor(hCtrl, Dialog.Color)  ENDIFENDPUBLIC SUB btnFont_Click()  Dialog.Font = edtEditor.Font  IF Dialog.SelectFont() THEN RETURN  SetFont(Dialog.Font)ENDPUBLIC SUB SetFont(hFont AS Font)  edtEditor.Font = hFont  lblFont.Font = hFont  lblFont.Text = hFont.ToString()ENDPUBLIC SUB btnApply_Click()  DoApplyENDPRIVATE FUNCTION DoApply() AS Boolean  DIM hFile AS Object  DIM sFont AS String  DIM hCtrl AS Control  DIM vVal AS Variant  sFont = edtEditor.Font.ToString()  Settings["/Editor/Font"] = sFont  Settings["/Editor/Toolbar"] = chkEditorToolbar.Value  Settings["/Editor/CleanOnSave"] = chkClean.Value  Settings["/Editor/ShowProc"] = chkShowProc.Value  Settings["/Editor/ShowChange"] = chkShowChange.Value  Settings["/Editor/ShowCurrent"] = chkShowCurrent.Value  Settings["/Editor/UseRelief"] = chkUseRelief.Value  FOR EACH hCtrl IN svwColor.Children    IF hCtrl.Tag THEN      Settings["/Editor/Color[" & hCtrl.Tag & "]"] = "&" & Hex$(hCtrl.Background, 6) & "&"    ENDIF  NEXT  Settings["/ShowMascot"] = chkShowMascot.Value  Settings["/ShowTooltip"] = chkShowTooltip.Value  Settings["/ShowCompletion"] = chkShowCompletion.Value  Settings["/HandleSize"] = txtHandle.Value  Settings["/Toolbar/Animate"] = chkAnimate.Value  Settings["/Toolbar/IconSize"] = txtIcon.Value  Settings["/DefaultTabSize"] = txtTabSize.Value  Settings["/DefaultGridResolution"] = txtGrid.Value  Settings["/UseSmallFont"] = chkSmallFont.Value  IF Settings["/DisplayForm"] <> chkDisplayForm.Value THEN    Settings["/DisplayForm"] = chkDisplayForm.Value    Project.Refresh  ENDIF  FGambas.Visible = chkShowMascot.Value  Application.Tooltip.Enabled = chkShowTooltip.Value  FOR EACH hFile IN Project.Files    TRY hFile.ReadConfig()  NEXT  CControl.RefreshHandleSize  FDebug.ReadConfig  FProperty.ReadConfig  FMain.ReadConfig  FToolBox.ReadConfig  Settings.Save  RETURN FALSEEND' PUBLIC SUB btnInvert_Click()''   DIM hCtrl AS Control''   FOR EACH hCtrl IN svwColor.Children''     IF hCtrl.Tag THEN'       SetColor(hCtrl, &HFFFFFF& - hCtrl.BackColor, TRUE)'     ENDIF''   NEXT''   edtEditor.Refresh'' ENDPUBLIC SUB chkShowMascot_Click()  picGambas.Picture = Picture[If(chkShowMascot.Value, "img/anim/gambas1.png", "img/anim/gambas8.png")]ENDPUBLIC SUB cmbTheme_Click()  DIM hCtrl AS Control  IF cmbTheme.Index = 0 THEN RETURN  $iTheme = cmbTheme.Index - 1  FOR EACH hCtrl IN svwColor.Children    IF hCtrl.Tag THEN      SetColor(hCtrl, -1, TRUE)    ENDIF  NEXT  RefreshEditorENDPUBLIC SUB tabOption_Click()  edtEditor.Move(lblEditor.X + tabOption.X + tabOption.ClientX, lblEditor.Y + tabOption.Y + tabOption.ClientY, lblEditor.W, lblEditor.H)  edtEditor.Visible = tabOption.Index <> 2ENDPUBLIC SUB Form_Show()  tabOption_ClickENDPRIVATE SUB RefreshEditor()  edtEditor.Line = 16  edtEditor.Column = Len(edtEditor.Lines[edtEditor.Line])  edtEditor.Refresh  edtEditor.SetFocusENDPUBLIC SUB chkShowProc_Click()  edtEditor.ShowProc = chkShowProc.ValueENDPUBLIC SUB chkShowCurrent_Click()  edtEditor.ShowCurrent = chkShowCurrent.ValueENDPUBLIC SUB chkUseRelief_Click()  edtEditor.UseRelief = chkUseRelief.ValueENDPUBLIC SUB chkShowChange_Click()  edtEditor.ShowChange = chkShowChange.ValueEND

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -