#90256 - 2002-12-05 04:23 PM
Re: KiXforms - PostPrep 0.9 (Preview)
|
Shawn
Administrator
   
Registered: 1999-08-13
Posts: 8611
|
Heres a method for generating a quick palette - ripped from KiXtart PiXaso Paint:
code:
Break On $frmDialog1 = createobject("Kixtart.Form") $frmDialog1.Size = 490,160 $frmDialog1.Caption = "Select Colors" $picChoice = $frmDialog1.PictureBox(,5,30,473,88) $picChoice.DrawWidth = 1 ; pixels $picChoice.FillStyle = 1 ; solid For $b = 0 to 255 Step 51 For $g = 0 to 255 Step 51 For $r = 0 to 255 Step 51 $$picChoice.FillColor = ($b*256*256)+($g*256)+$r $$picChoice.Rectangle($Left,$Top,14,15) $Left = $Left + 13 if $Left = 468 $Left = 0 $Top = $Top + 14 EndIf Next Next Next $frmDialog1.Center $frmDialog1.Show while $frmDialog1.Visible $ = execute($frmDialog1.DoEvents) loop Exit 1
-Shawn
|
|
Top
|
|
|
|
#90258 - 2002-12-05 08:55 PM
Re: KiXforms - PostPrep 0.9 (Preview)
|
Jochen
KiX Supporter
   
Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
|
Very Cool Shawn !!!
Hmmm .. me knewed that as we talked about it last week IIRC ...
However, knowing that there will be a way, here is the latest preview :
code:
;PostPrep 1.0 (Preview)
; KIXTART 4.12 (WKiX32) ; KIXFORMS build 37 ; AUTHOR Jochen Polster
break on
$ReqFormsBuild = 36 $Version = "1.0" $Wordfile = @scriptdir + '\Wordfile.ini' $Kix = substr(@kix,1,4)
Global $SourceText[0],$Colors[6]
$Sections = "Comments","Strings","Numbers","Commands","Functions","Macros","Operators"
;if exist($Wordfile) ; for $i = 0 to 6 ; $Colors[$i] = readprofilestring($Wordfile,$Sections[$i],"Color") ; next ; $Commands = split(readprofilestring($Wordfile,"Commands", "words"),',') ; $Functions = split(readprofilestring($Wordfile,"Functions","words"),',') ; $Macros = split(readprofilestring($Wordfile,"Macros", "words"),',') ; $Operators = split(readprofilestring($Wordfile,"Operators","words"),',') ; if not ubound($commands) ; or not ubound($functions) ; or not ubound($macros) ; or not ubound($Operators) ; or not ubound($Colors) ; $ = messagebox('This Script requires a wordfile ','Unexpected Error',4112) ; quit() ; endif ;else ; $ = messagebox('This Script requires a wordfile ','Unexpected Error',4112) ; quit() ;endif
$frm = createobject("Kixtart.Form")
if val($frm.Build) < $ReqFormsBuild $ = messagebox('This Script requires Kixforms build ' + $ReqFormsBuild,'Version check',4112) quit() endif
$frm.Size = 800,620 $frm.Caption = "UBB Postprep " + $Version $frm.Icon = "SHELL32.dll;2" $frm.Center
$lblPowered = $frm.Label("Powered by", $frm.ClientWidth-90,$frm.ClientHeight-100,90,20) $lblPowered.FontName = "Comic sans MS" $lblPowered.FontBold = 1 $lblPowered.FontSize = 11 $lblPowered.ForeColor = Kixtart
$lblBuild = $frm.Label(" KiXtart " + $kix + @crlf + " and" + @crlf + " KiXforms build " + $frm.Build, $frm.ClientWidth-90,$frm.ClientHeight-75,90,60) $lblBuild.FontName = "Comic sans MS" $lblBuild.FontBold = 1 $lblBuild.FontSize = 7 $lblBuild.ForeColor = Kixtart
$txtSource = $frm.TextBox $txtSource.Left = 5 $txtSource.Top = 5 $txtSource.Right = $frm.ClientWidth - 100 $txtSource.Bottom = $frm.ClientHeight / 2 - 3 $txtSource.ScrollBars = 3 $txtSource.FontName = "Courier New" $txtSource.FontSize = 8 $txtSource.MultiLine = 1
$txtTarget = $frm.TextBox $txtTarget.Left = 5 $txtTarget.Top = 5 + $txtSource.Bottom $txtTarget.Right = $frm.ClientWidth - 100 $txtTarget.Bottom = $frm.ClientHeight - 20 $txtTarget.ScrollBars = 3 $txtTarget.FontName = "Courier New" $txtTarget.FontSize = 8 $txtTarget.MultiLine = 1
$lblStatus1 = $frm.Label("",5,$frm.ClientHeight-17,$frm.ClientWidth/3*2,15) $lblStatus1.BorderStyle = 5
$lblStatus2 = $frm.Label("",$lblStatus1.Right+3,$frm.ClientHeight-17,$frm.ClientWidth/3-10,15) $lblStatus2.BorderStyle = 5
$prg = $lblStatus2.ProgressBar $prg.Size = $frm.ClientWidth/3-10,13 $prg.Style = 1 $prg.BorderStyle = 0 $prg.Value = 0
$btnOpen = $frm.Button $btnOpen.Caption = "Open..." $btnOpen.Left = $txtTarget.Right + 10 $btnOpen.Top = 5 $btnOpen.Width = 80 $btnOpen.Height = 25 $btnOpen.BorderStyle = 5 $btnOpen.OnClick = "btnOpen_Click()"
$btnColor = $frm.Button $btnColor.Caption = "Set Colors..." $btnColor.Left = $txtTarget.Right + 10 $btnColor.Top = $btnOpen.Bottom + 2 $btnColor.Width = 80 $btnColor.Height = 25 $btnColor.BorderStyle = 5 $btnColor.OnClick = "btnColor_Click()"
dim $Top $Top = $btnColor.Bottom + 10 for $i = 0 to ubound($Sections) $ = execute("$$txtFormat$i = $$frm.TextBox($$Sections[$i],$$txtTarget.Right+10,$Top,80,20)") $ = execute("$$txtFormat$i.Caption = $$Sections[$i]") $ = execute("$$txtFormat$i.ForeColor = val(readprofilestring($Wordfile,$$Sections[$i],'Color'))") $ = execute("$$txtFormat$i.FontBold = val(readprofilestring($Wordfile,$$Sections[$i],'Bold'))") $ = execute("$$Top = $$txtFormat$i.Bottom + 7") next
$btnConvert = $frm.Button $btnConvert.Caption = "Convert" $btnConvert.Left = $txtTarget.Right + 10 $btnConvert.Top = $txtFormat6.Bottom + 45 $btnConvert.Width = 80 $btnConvert.Height = 25 $btnConvert.BorderStyle = 5 $btnConvert.OnClick = "btnConvert_Click()" $btnConvert.Enabled = 0
$frm.Show while $frm.Visible $ = execute($frm.DoEvents) loop
function btnColor_Click() dim $frmDialog1, $cR, $cG, $cB, $c, $steps, $h, $index
$index = 0
$frmDialog1 = createobject("Kixtart.Form") $frmDialog1.Size = 300,244 $frmDialog1.Caption = "Set Colors" $frmDialog1.Location = $frm.Right - $frmDialog1.ClientWidth - 107 , $frm.Top + $btnColor.Bottom
$cboStrings = $frmDialog1.ComboBox $cboStrings.List = "Comments","Strings","Numbers","Commands","Functions","Macros","Operators" $cboStrings.Location = 5,5 $cboStrings.ListIndex = 0 $cboStrings.Style = 1 $cboStrings.OnClick = "$$index = cboStrings_OnCLick($$cboStrings.ListIndex)"
$chkBold = $frmDialog1.CheckBox("Bold",120,9,50,15) $chkBold.OnClick = "chkBold_Click($$index)"
$btnClose = $frmDialog1.Button("Close",$frmDialog1.ClientWidth-89,5,80,25) $btnClose.OnClick = "$$frmDialog1.Hide" $btnClose.Cancel = 1
$picChoice = $frmDialog1.PictureBox("",8,50,279,160) $picChoice.DrawWidth = 2 ;pixels $picChoice.FillStyle = 1 ;solid $picChoice.BorderStyle = 0 $picChoice.OnClick = "Color_Change($$index)"
$cR = 64 $cG = 64 $cB = 64 $Steps = 84
for $i = 4 to $picChoice.ClientHeight step 23 for $j = 4 to $picChoice.ClientWidth step 23 $c = "" + dectohex($cR) + dectohex($cG) + dectohex($cB) if $cR < 16 $c = "0" + $c endif if $cG < 16 $c = substr($c,1,2)+"0"+substr($c,3,len($c)) endif if $cB < 16 $c = substr($c,1,4)+"0"+substr($c,4,len($c)) endif $c = substr($c,1,6) $ = execute("$$picChoice.ForeColor = &$c") $ = execute("$$picChoice.FillColor = &$c") $picChoice.Rectangle($j,$i,19,19) select case $h < $Steps / 3 $cR = $cR + ( 255 / 28 ) case $h > $Steps / 3 and $h < $steps / 3 * 2 $cR = 64 $cB = 64 $cG = $cG + ( 255 / 28 ) case $h > $Steps / 3 * 2 $cG = 64 $cR = 255 $cB = $cB + ( 255 / 28 ) endselect $h = $h + 1 next next
$frm.Enabled = 0 $frmDialog1.Show
while $frmDialog1.Visible $ = execute($frmDialog1.DoEvents) loop
$frm.Enabled = 1 endfunction
function btnConvert_Click() $txtTarget.BeginUpdate
$txtTarget.EndUpdate endfunction
function btnOpen_Click() dim $FileName, $nl $FileName = $frm.FileOpenDialog("Open File ...", "", "", "KiX Files|*.kix;*.udf;*.k2k|All Files|*.*", 1) if $FileName $ = open(1,$Filename,2) if not @error dim $count $txtSource.Text = "" redim $SourceText[0] $frm.MousePointer = 11 $txtSource.BeginUpdate $SourceText[0] = readline(1) $txtSource.Text = "" + $SourceText[0] while @error = 0 redim preserve $SourceText[ubound($SourceText)+1] $SourceText[ubound($SourceText)] = $nl $txtSource.Text = $txtSource.Text + @crlf + $SourceText[ubound($SourceText)] $nl = readline(1) loop $ = close(1) $txtSource.EndUpdate $frm.MousePointer = 0 $btnConvert.Enabled = 1 $lblStatus1.Caption = " " + $FileName endif endif endfunction
function cboStrings_OnClick($i) dim $y $index = $i $ = execute("if $$txtFormat$index.FontBold $$y = 1 endif") if $y $chkBold.Value = 1 else $chkBold.Value = 0 endif $cboStrings_OnClick = $i endfunction
function chkBold_Click($i) if $chkBold.Value $ = execute("$$txtFormat$i.FontBold = 1") $ = writeprofilestring($WordFile,$Sections[$i],"Bold",1) else $ = execute("$$txtFormat$i.FontBold = 0") $ = writeprofilestring($WordFile,$Sections[$i],"Bold",0) endif endfunction
function Color_Change($i) dim $Choice $Choice = $picChoice.Point($picChoice.MouseX,$picChoice.MouseY) $ = execute("$$txtFormat$i.ForeColor = $Choice") $ = writeprofilestring($WordFile,$Sections[$i],"Color",$Choice) endfunction
TODO :
-> (maybe) a Listview subform to maintain Keywords -> The convert thingie of course ! -> Select / Copy buttons for TargetTestBox
J.
_________________________
|
|
Top
|
|
|
|
#90259 - 2002-12-05 09:11 PM
Re: KiXforms - PostPrep 0.9 (Preview)
|
Jochen
KiX Supporter
   
Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
|
|
|
Top
|
|
|
|
#90261 - 2002-12-05 09:29 PM
Re: KiXforms - PostPrep 0.9 (Preview)
|
Jochen
KiX Supporter
   
Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
|
Will keep in mind ... Wah things just getting better; Here the Updated Version (Preview still) :
code:
;PostPrep 1.0
; KIXTART 4.12 (WKiX32) ; KIXFORMS build 37 ; AUTHOR Jochen Polster
break on
$ReqFormsBuild = 36 $Version = "1.0" $Wordfile = @scriptdir + '\Wordfile.ini' $Kix = substr(@kix,1,4)
Global $SourceText[0],$Colors[6]
$Sections = "Comments","Strings","Numbers","Commands","Functions","Macros","Operators"
;if exist($Wordfile) ; for $i = 0 to 6 ; $Colors[$i] = readprofilestring($Wordfile,$Sections[$i],"Color") ; next ; $Commands = split(readprofilestring($Wordfile,"Commands", "words"),',') ; $Functions = split(readprofilestring($Wordfile,"Functions","words"),',') ; $Macros = split(readprofilestring($Wordfile,"Macros", "words"),',') ; $Operators = split(readprofilestring($Wordfile,"Operators","words"),',') ; if not ubound($commands) ; or not ubound($functions) ; or not ubound($macros) ; or not ubound($Operators) ; or not ubound($Colors) ; $ = messagebox('This Script requires a wordfile ','Unexpected Error',4112) ; quit() ; endif ;else ; $ = messagebox('This Script requires a wordfile ','Unexpected Error',4112) ; quit() ;endif
$frm = createobject("Kixtart.Form")
if val($frm.Build) < $ReqFormsBuild $ = messagebox('This Script requires Kixforms build ' + $ReqFormsBuild,'Version check',4112) quit() endif
$frm.Size = 800,620 $frm.Caption = "UBB Postprep " + $Version $frm.Icon = "SHELL32.dll;2" $frm.Center
$lblPowered = $frm.Label("Powered by", $frm.ClientWidth-90,$frm.ClientHeight-100,90,20) $lblPowered.FontName = "Comic sans MS" $lblPowered.FontBold = 1 $lblPowered.FontSize = 11 $lblPowered.ForeColor = Kixtart
$lblBuild = $frm.Label(" KiXtart " + $kix + @crlf + " and" + @crlf + " KiXforms build " + $frm.Build, $frm.ClientWidth-90,$frm.ClientHeight-75,90,60) $lblBuild.FontName = "Comic sans MS" $lblBuild.FontBold = 1 $lblBuild.FontSize = 7 $lblBuild.ForeColor = Kixtart
$txtSource = $frm.TextBox $txtSource.Left = 5 $txtSource.Top = 5 $txtSource.Right = $frm.ClientWidth - 100 $txtSource.Bottom = $frm.ClientHeight / 2 - 3 $txtSource.ScrollBars = 3 $txtSource.FontName = "Courier New" $txtSource.FontSize = 8 $txtSource.MultiLine = 1
$txtTarget = $frm.TextBox $txtTarget.Left = 5 $txtTarget.Top = 5 + $txtSource.Bottom $txtTarget.Right = $frm.ClientWidth - 100 $txtTarget.Bottom = $frm.ClientHeight - 20 $txtTarget.ScrollBars = 3 $txtTarget.FontName = "Courier New" $txtTarget.FontSize = 8 $txtTarget.MultiLine = 1
$lblStatus1 = $frm.Label("",5,$frm.ClientHeight-17,$frm.ClientWidth/3*2,15) $lblStatus1.BorderStyle = 5
$lblStatus2 = $frm.Label("",$lblStatus1.Right+3,$frm.ClientHeight-17,$frm.ClientWidth/3-10,15) $lblStatus2.BorderStyle = 5
$prg = $lblStatus2.ProgressBar $prg.Size = $frm.ClientWidth/3-10,13 $prg.Style = 1 $prg.BorderStyle = 0 $prg.Value = 0
$btnOpen = $frm.Button $btnOpen.Caption = "Open..." $btnOpen.Left = $txtTarget.Right + 10 $btnOpen.Top = 5 $btnOpen.Width = 80 $btnOpen.Height = 25 $btnOpen.BorderStyle = 5 $btnOpen.OnClick = "btnOpen_Click()"
$btnColor = $frm.Button $btnColor.Caption = "Set Colors..." $btnColor.Left = $txtTarget.Right + 10 $btnColor.Top = $btnOpen.Bottom + 2 $btnColor.Width = 80 $btnColor.Height = 25 $btnColor.BorderStyle = 5 $btnColor.OnClick = "btnColor_Click()"
dim $Top $Top = $btnColor.Bottom + 10 for $i = 0 to ubound($Sections) $ = execute("$$txtFormat$i = $$frm.TextBox($$Sections[$i],$$txtTarget.Right+10,$Top,80,20)") $ = execute("$$txtFormat$i.Caption = $$Sections[$i]") $ = execute("$$txtFormat$i.ForeColor = val(readprofilestring($Wordfile,$$Sections[$i],'Color'))") $ = execute("$$txtFormat$i.FontBold = val(readprofilestring($Wordfile,$$Sections[$i],'Bold'))") $ = execute("$$Top = $$txtFormat$i.Bottom + 7") next
$btnConvert = $frm.Button $btnConvert.Caption = "Convert" $btnConvert.Left = $txtTarget.Right + 10 $btnConvert.Top = $txtFormat6.Bottom + 45 $btnConvert.Width = 80 $btnConvert.Height = 25 $btnConvert.BorderStyle = 5 $btnConvert.OnClick = "btnConvert_Click()" $btnConvert.Enabled = 0
$frm.Show while $frm.Visible $ = execute($frm.DoEvents) loop
function btnColor_Click() dim $frmDialog1, $Left, $Top, $index
$index = 0
$frmDialog1 = createobject("Kixtart.Form") $frmDialog1.Size = 254,240 $frmDialog1.Caption = "Set Colors" $frmDialog1.Location = $frm.Right - $frmDialog1.ClientWidth - 107 , $frm.Top + $btnColor.Bottom
$cboStrings = $frmDialog1.ComboBox $cboStrings.List = "Comments","Strings","Numbers","Commands","Functions","Macros","Operators" $cboStrings.Location = 5,7 $cboStrings.ListIndex = 0 $cboStrings.Style = 1 $cboStrings.OnClick = "$$index = cboStrings_OnCLick($$cboStrings.ListIndex)"
$chkBold = $frmDialog1.CheckBox("Bold",115,11,50,15) $chkBold.OnClick = "chkBold_Click($$index)"
$btnClose = $frmDialog1.Button("Close",$frmDialog1.ClientWidth-83,7,75,22) $btnClose.OnClick = "$$frmDialog1.Hide" $btnClose.Cancel = 1
$picChoice = $frmDialog1.PictureBox(,5,40,239,185) $picChoice.DrawWidth = 1 ;pixels $picChoice.FillStyle = 1 ;solid $picChoice.BorderStyle = 0 $picChoice.OnClick = "Color_Change($$index)"
for $b = 0 to 255 step 51 for $g = 0 to 255 step 51 for $r = 0 to 255 step 51 $picChoice.FillColor = ($b*256*256)+($g*256)+$r $picChoice.Rectangle($Left,$Top,14,15) $Left = $Left + 13 if $Left = 234 $Left = 0 $Top = $Top + 14 endif next next next
$frm.Enabled = 0 $frmDialog1.Show
while $frmDialog1.Visible $ = execute($frmDialog1.DoEvents) loop
$frm.Enabled = 1 endfunction
function btnConvert_Click() $txtTarget.BeginUpdate
$txtTarget.EndUpdate endfunction
function btnOpen_Click() dim $FileName, $nl $FileName = $frm.FileOpenDialog("Open File ...", "", "", "KiX Files|*.kix;*.udf;*.k2k|All Files|*.*", 1) if $FileName $ = open(1,$Filename,2) if not @error dim $count $txtSource.Text = "" redim $SourceText[0] $frm.MousePointer = 11 $txtSource.BeginUpdate $SourceText[0] = readline(1) $txtSource.Text = "" + $SourceText[0] while @error = 0 redim preserve $SourceText[ubound($SourceText)+1] $SourceText[ubound($SourceText)] = $nl $txtSource.Text = $txtSource.Text + @crlf + $SourceText[ubound($SourceText)] $nl = readline(1) loop $ = close(1) $txtSource.EndUpdate $frm.MousePointer = 0 $btnConvert.Enabled = 1 $lblStatus1.Caption = " " + $FileName endif endif endfunction
function cboStrings_OnClick($i) dim $y $index = $i $ = execute("if $$txtFormat$index.FontBold $$y = 1 endif") if $y $chkBold.Value = 1 else $chkBold.Value = 0 endif $cboStrings_OnClick = $i endfunction
function chkBold_Click($i) if $chkBold.Value $ = execute("$$txtFormat$i.FontBold = 1") $ = writeprofilestring($WordFile,$Sections[$i],"Bold",1) else $ = execute("$$txtFormat$i.FontBold = 0") $ = writeprofilestring($WordFile,$Sections[$i],"Bold",0) endif endfunction
function Color_Change($i) dim $Choice $Choice = $picChoice.Point($picChoice.MouseX,$picChoice.MouseY) $ = execute("$$txtFormat$i.ForeColor = $Choice") $ = writeprofilestring($WordFile,$Sections[$i],"Color",$Choice) endfunction
_________________________
|
|
Top
|
|
|
|
#90262 - 2002-12-05 09:31 PM
Re: KiXforms - PostPrep 0.9 (Preview)
|
Jochen
KiX Supporter
   
Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
|
|
|
Top
|
|
|
|
#90267 - 2002-12-05 10:06 PM
Re: KiXforms - PostPrep 0.9 (Preview)
|
Jochen
KiX Supporter
   
Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
|
|
|
Top
|
|
|
|
#90268 - 2002-12-06 08:38 AM
Re: KiXforms - PostPrep 0.9 (Preview)
|
Jochen
KiX Supporter
   
Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
|
|
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 1003 anonymous users online.
|
|
|