Jump to content
FHannes

SCAR Divi 3.37 Beta

Recommended Posts

Time for some Beta builds. Because 3.37 contains some very important bugfixes, I have decided to push the release forward to this month, rather than releasing a minor bugfix build for 3.36. I will be adding some additional functionality into the color tools and some new TPA related functions before the RC hits. For now, I'd recommend using this build over 3.36. The final version of this will be released in 2 weeks tops.

 

Regular: http://svn.scar-divi.com/scar/

Portable: http://svn.scar-divi.com/scar_portable/

 

Setup instructions: http://forums.scar-divi.com/showthread.php?505-Downloading-SCAR-Divi-Prerelease

 

Changelog:

Bugfixes:
- [#127] Double clicking on a form element in the form designer will no longer assign an event internally
- [#136] SCAR process sometimes did not terminate
- Some selection features in color tools did not work properly
- Dragging color tools items from/to stored colors sometimes lagged or froze SCAR
- Small memory leak when loading png images
- [#133] The new FindColor(s)SpiralTol(Ex) and FindColor(s)TPATol(Ex) functions did not return the correct results
- [#139] Menu in DTM editor was detachable
- GetCurrentKeyState and GetToggleKeyState did not function correctly for TSCARWindowClient
- [#142] Some system colors were imported incorrectly
- [#143] Several dialog functions were malfunctioning
- TSCARBitmap.DC changed when TSCARBitmap.Flip() ot TSCARBitmap.Rotate() were called
- TSCARBitmap.LoadFromStr set the entire bitmap to transparant
- Error in firewall config when adding a rule

New:
- Rename button in color tools rightclick menu
- procedure TPAEdge(var TPA: TPointArray);
- Capture Client button in DTM editor Edit menu
- TTPAArtifacts = set of (taXAxis, taYAxis)
- function BmpFromTPA(const TPA: TPointArray; const FgCol, BgCol: Integer): TSCARBitmap;
- function BmpFromTPAEx(const TPA: TPointArray; const FgCol, BgCol, AfCol: Integer; const Scale: Single; const Artifacts: TTPAArtifacts): TSCARBitmap;
- function TSCARBitmap.GetPixels(const TPA: TPointArray): TIntArray;
- procedure TSCARBitmap.SetPixels(const TPA: TPointArray; const Color: Integer);
- procedure TSCARBitmap.Skew(const Horiz, Vert: Single);
- function LibsPath: string;
- function ScriptsPath: string;
- procedure TSCARBitmap.RotateEx(const Angle: Extended; const Resize: Boolean);
- procedure TSCARBitmap.SkewEx(const Horiz, Vert: Single; const Resize: Boolean);
- function StrToPoint(const Str: string): TPoint;
- function StrToPointDef(const Str: string; const Default: TPoint): TPoint;
- function PointToStr(const Point: TPoint): string;
- function StrToBox(const Str: string): TBox;
- function StrToBoxDef(const Str: string; const Default: TBox): TBox;
- procedure ExpandBox(var Box: TBox; const SizeChange: Integer);
- procedure OffsetBox(var Box: TBox; const XOffset, YOffset: Integer);
- function TPAEquals(const TPA1, TPA2: TPointArray): Boolean;
- function TIAEquals(const TIA1, TIA2: TIntArray): Boolean;
- function TEAEquals(const TEA1, TEA2: TExtArray): Boolean;
- Added all DateUtils routines: http://docwiki.embarcadero.com/Libraries/XE2/en/System.DateUtils#Routines
- function BoxCenter(const Box: TBox): TPoint;
- procedure TPADistToPoint(const TPA: TPointArray; const Point: TPoint; out MinDist, MaxDist: Extended);
- procedure TPADistToPointEx(const TPA: TPointArray; const Point: TPoint; out MinDist, MaxDist: Extended; out MinPoint, MaxPoint: TPoint);
- Option to toggle template completion 

Tweaks:
- TSCARBitmap's SaveToBmp, SaveToJpeg and SaveToPng now creates the target folder if it does not exist
- It is now possible to ctrl+click to add an item to the selection in color tools
- Huge performance improvements for all TPAFilterX and TPAExtractX functions
- Huge performance improvements for TPAIntersect and TIAIntersect
- CreateMessageDialog tied into resource manager for forms
- Added thread-safety for CreateMessageDialog, MessageDlg, MessageDlgPos, TaskMessageDlg, TaskMessageDlgPos, ShowMessage,
    ShowMessageFmt, ShowMessagePos, InputBox and InputQuery
- Removed the HelpCtx parameter from MessageDlg, MessageDlgPos, TaskMessageDlg and TaskMessageDlgPos
- ImageBox/InputBox in Target Client renamed to ImageArea/InputArea for consistency
- More accurate rotation algorithm for TSCARBitmap.Rotate()
- The databox in the color picker is now wider to accommodate the large coordinates on modern screens
- Moved color squares in the color picker's databox to the left to be consistent with the datapicker
- Color picker magnifier now has red corners around the center pixel, the bitmap picker has been adjusted accordingly
- The databox in the color picker now repositions around your cursor when it reaches the edges of the monitor your cursor is currently on
- function Distance(const X1, Y1, X2, Y2: Integer): Extended; (now returns extended)
- Editing the name of items in color tools is no longer possible through clicking
- The delete key now allows you to delete items from color tools as well
- You can now group colors (and groups) together into groups in the color tools

 

Enjoy :)

 

~Freddy

Edited by Freddy
Link to comment
Share on other sites

Yay!! Thanks a lot for fixing FindColor(s)SpiralTol(Ex). :P

 

Glad you decided to change the plan for releasing this version a little earlier (with those very important fixes included)

 

Keep up the good work!

 

P.S. Pretty damn excited about those TPA functions, can't wait to see what you can come up with! :)

 

-Jani

Link to comment
Share on other sites

Yay for the rename menu :D... things just keep getting better, thanks Freddy

 

Yeah btw, I got some more bugs to report, I'll load up the bug tracker right now. But they have nothing to do with color tools or forms xD

 

I'll be waiting for them :) Just make sure you don't wait too long, 3.37 will be pushed out pretty fast.

Link to comment
Share on other sites

Nice, now the forms will look right, and I learned some things.

 

GetBoxSize...

 

Here is a comparison, using all of SCAR's dialog functions:

 

[scar]

program New;

var

value: string;

begin

ShowMessage('Wooohahahhahah ShowMessage');

ShowMessageFmt('Woaohahaha ShowMessageFmt: <%d>', [1234]);

ShowMessagePos('WOoooooo ShowMessagePos', 0, 0);

TaskMessageDlg('Testing TaskMessageDlg', 'Boooooooooooooooooooooo', mtConfirmation, [mbOK], 0);

TaskMessageDlgPos('Testing TaskMessageDlgPos', 'Boooooooooooo', mtWarning, [mbYes, mbCancel], 0, 50, 50);

MessageDlg('MessageDlg Wooooo', mtCustom, [mbOK], 0);

MessageDlgPos('MessageDlgPos woooooo', mtInformation, [mbOK], 0, 50, 50);

InputBox('InputBox, Woooo', 'Do you want input box?', 'Yes');

InputQuery('InputQuery woooooo', 'Hi do you want queries?', value);

WriteLn(value);

CreateMessageDialog('CreateMessageDialog Woooooo', mtError, [mbOK]);

end.

 

[/scar]

 

I don't think CreateMessageDialog is working though. That or SCAR just crashed for another reason:

 

1qoA7.png

 

And where are my Coordinates, that SCAR usually shows? Lols probably need to clear appdata again

Link to comment
Share on other sites

Some of these functions work with forums, they aren't thread-safe...

 

[scar]procedure CreateMsgDlg;

var

F: TForm;

begin

F := CreateMessageDialog('CreateMessageDialog Woooooo', mtError, [mbOK]);

try

F.ShowModal;

finally

F.Free;

end;

end;

 

var

V: TVariantArray;

 

begin

V := [];

ThreadSafeCall('CreateMsgDlg', V);

end.[/scar]

 

EDIT: I'm going to make CreateMessageDialog itself thread-safe and tie it into the resource manager so it behaves like other forms.

Link to comment
Share on other sites

I've decided to add all of these functions into SCAR's main API rather than the forms API. As such, I've made all of them thread-safe, so you don't have tto use ThreadSafeCall to use them (which would currently cause errors [but not always]). Of course CreateMessageDialog still returns a form, so you'll have to use ThreadSafeCall to use this form as you would normally. I have however removed the HelpCtx parameter from all functions that had it.

Link to comment
Share on other sites

I've committed a new build with all of the thread-safe functions and such. @LordJashin: I also fixed your mouse coordinates.

 

I'd also recommend forcing people to 3.37 once it's released in OSI.

 

K,

 

I've made all the functions thread safe (the ones that needed it), and going to update OSI soon.

Link to comment
Share on other sites

Also, Freddy, I've got an idea. Can you add like a AddToScriptTerminate procedure? Or AddToTerminate. I'm trying to overload the ScriptTerminate procedure to add a (Safe) function that uses TaskmessageDlg to display an error telling people to Update their SCAR Versions:

 

Then I could put this at the TOP of OSI.scar where the IFDEF SCAR's are.

 

eg6SC.png

Link to comment
Share on other sites

Also, Freddy, I've got an idea. Can you add like a AddToScriptTerminate procedure? Or AddToTerminate. I'm trying to overload the ScriptTerminate procedure to add a (Safe) function that uses TaskmessageDlg to display an error telling people to Update their SCAR Versions:

 

Then I could put this at the TOP of OSI.scar where the IFDEF SCAR's are.

 

eg6SC.png

I have been thinking about this aswell (AddOnTerminate), it would be sooooo much more useful (especially in includes) than just having ScriptTerminate procedure.

But mate, I think you should request it at MantisBT, like all suggestions. :)

 

Sure hope it will be added though!

Edited by Janilabo
Link to comment
Share on other sites

Well I thought their might be a way to overload it, but I guess not. He probably won't agree with this idea, so I guess I'll just wait for the Includes system to come out for this.

 

Almost done with this form I'm adding, then I'll update OSI.

 

Is there a way to ThreadSafeCall a function, and pass parameters? Also what does the v hold? True or false or just the result of the function?

Link to comment
Share on other sites

I'm actually already planning on implementing such a system, but go ahead and post it up on mantis if you like, it's not really high up on my todo list atm. I don't really see why you need to put this in a terminate callback though... Or how it would change anything, if you use 3.37 stuff, the script still won't compile in 3.35, so the callback would never be called anyway. That's why there's the {$ERROR } directive.

Link to comment
Share on other sites

Yeah, I would mainly use AddOnTerminate for unsetupment of MSSL, that way I wouldn't need to use it anymore for scripts.. :)

If I use ScriptTerminate inside MSSL, and someone also uses it in hes/her MSSL-based script aswell, that would give Duplicate identifier Compiler Error (that's obvious, of course)..

Thats why AddOnTerminate would be nice thing to have.

 

But as I see you have already planned that kind of a system, I'll see what future brings someday. :)

 

-Jani

Link to comment
Share on other sites

Well, I have experimented and...

 

Some Dialog functions work fine in 3.35-3.36. Its just they are not "ThreadSafe" so you must use the ThreadSafeCall function.

For 3.37 they automatically do this. But doing ThreadSafeCall on them, shouldn't be bad.

Dialog functions DO NOT WORK under ThreadSafeCall if a Form is loaded!!! I don't know why this is weird...

 

I think the AddOnTerminate/Overload ScriptTerminate would be great. We can always use {$IFDEF SCAR337_UP} if we need to. I just thought it would be nice to have a message dialog for Updating SCAR for OSI to work. And the way to do this would be like this:

 

[scar]

 

// Check if SCAR Divi is version 3.35 or higher

{$IFNDEF SCAR335_UP}

procedure ScriptTerminate; overload; // override it somehow/overload w/e

begin

{$IFDEF SCAR337_UP}

TaskMessageDlg('Please Update SCAR Divi', 'OSI: Please update SCAR Divi to version 3.35 or higher to run this script!', mtWarning, [mbClose]);

{$ELSE}

TaskMessageDlg('Please Update SCAR Divi', 'OSI: Please update SCAR Divi to version 3.35 or higher to run this script!', mtWarning, [mbClose], 0);

{$ENDIF}

end;

{$IFDEF SCAR320_UP}

{$ERROR OSI: Please update SCAR Divi to version 3.35 or higher to run this script!}

{$ELSE}

'OSI: Please update SCAR Divi to version 3.35 or higher to run this script!'

{$ENDIF}

{$ENDIF}

[/scar]

 

Ofc though we would need to put TaskMessage in another function. Then just call it using ThreadSafeCall

Link to comment
Share on other sites

LJ, can't you do something like this (doesn't really require terminating):

 

{$IFNDEF SCAR336_UP}
 begin           
   TaskMessageDlg('Please Update SCAR Divi', 'OSI: Please update SCAR Divi to version 3.37 or higher to run this script!', mtWarning, [mbClose], 0); 
 end.
{$ENDIF}

begin
 WriteLn('Yay, SCAR Divi 3.37[+]!');
end.

 

I do this in MSSL: http://svn.scar-divi.com/mssl/trunk/MSSL.scar (although I use $ERROR, but I could replace it with mainloop + MessageDlg)

  • Like 1
Link to comment
Share on other sites

I've uploaded a new build that comes with the new BmpFromTPA(Ex), which allows you to draw a TPA onto a bitmap. Tha background is also assigned set up for alpha blanding by default. So if you enable AlphaBlend, you can it as an overlay onto another bitmap easily. Check this sample: http://svn.scar-divi.com/scar/samples/BmpFromTPAEx.scar

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...