PDA

View Full Version : SCAR Notepad



Da 0wner
03-30-2008, 08:37 PM
This is a little project i'm going to work on for a few days/weeks.

What it has so far

Resizable
Color/Size/Font changing
Open/Save

What i'm planning to add

SCAR Syntax highlighting
Underline compiling errors.

So just download and press play. Post suggustions.

mixster
03-30-2008, 08:49 PM
Uggh, the standards, they burn :eek:
Other than that, it's a pretty cool Scar notepad, though I've made a Delphi version so I was disappointed to not find a few of the more useful options. Also, I don't think you can change the font for only selected text unless you made it dynamically create memo's yo store the text and then changed only that, though I think that could mess up the view. Maybe try and find a Delphi way of doing it and seeing if that works with Scar - that's what I always do.
Edit: I just realised this, but why would you want to code in a notepad inside scar when you could just code in scar? It's a mini-paradox I say!

Da 0wner
03-30-2008, 08:52 PM
yea my standards suck. Can you give me some suggustions pl0x. And you changed your name :)

Hobbit
03-30-2008, 08:56 PM
Maybe if you get the SCAR syntaxing figured out, make it optional..

nielsie95
03-30-2008, 08:58 PM
If you want to change the style of the selected text only, use a TRichEdit. You can change the selection with SelAttributes.

Da 0wner
03-30-2008, 08:58 PM
Ty nielse :) credits for you

edit: but i can't get a scrollbar to go on a trichedit what do i use on that.

Dan Cardin
03-30-2008, 09:01 PM
as far as i know, you cant do the font thing(ive tried). and my syntax highlighter, doesnt work yet so, i cant help you with that either :p.

i dont want to give you too many suggestions, because if you look in my sig...:p

EDIT: as for scrollbar on trichedit - i requested freddy to add it into 3.15 and it is, you need hidescrollbars := false;
scrollbars := ssvertical;

and it doesnt matter, the fonts attribute for trichedit, isnt for the words its for the whole thing

nielsie95
03-30-2008, 09:08 PM
program New;
var
MainForm: TForm;

procedure InitForm;
begin
MainForm := CreateForm;
MainForm.Width := 400;
MainForm.Height := 400;
MainForm.Caption := 'MainForm';
MainForm.Color := clBtnFace;
MainForm.BorderIcons := [biSystemMenu];
MainForm.BorderStyle := bsSingle;
MainForm.Font.Color := clWindowText;
MainForm.Font.Height := -11;
MainForm.Font.Name := 'MS Sans Serif';
MainForm.Font.Style := [];
MainForm.PixelsPerInch := 96;

with TRichEdit.Create(MainForm) do
begin
Parent := MainForm;
Align := alClient;
ScrollBars := ssBoth;
HideScrollBars := False;
Text := 'hello there '+Chr(13)+'123'+chr(13)+'456';
SelStart := 0;
SelLength := Length('hello there ');
SelAttributes.Color := clTeal;
SelStart := Length('hello there ') + 1;
SelLength := Length('123');
SelAttributes.Style := SelAttributes.Style + [fsBold];
SelLength := 0;
end;
end;

procedure ShowFormModal;
begin
MainForm.ShowModal;
end;

var
v: TVariantArray;
begin
v := [];
ThreadSafeCall('InitForm', v);
ThreadSafeCall('ShowFormModal', v);
FreeForm(MainForm);
end.

Da 0wner
03-31-2008, 07:52 AM
nielse i tried doing what you said but this dosent work when i change what the font is


RichEdit1.SelAttributes.Name := FontDialog1.Font.Name;


what chagnes the type of font? etc arial, times new roman

Dan Cardin
03-31-2008, 11:06 AM
trichedit.font.Name is what changes the font. but like i said, all it does is change the font for the whole thing.

I bet you could install a component in delphi and plugin-it in to scar though(i just dont know how to :().

nielsie95
03-31-2008, 01:01 PM
program New;
var
MainForm: TForm;

procedure InitForm;
var
f: TFont;
begin
MainForm := CreateForm;
MainForm.Width := 400;
MainForm.Height := 400;
MainForm.Caption := 'MainForm';
MainForm.Color := clBtnFace;
MainForm.BorderIcons := [biSystemMenu];
MainForm.BorderStyle := bsSingle;
MainForm.Font.Color := clWindowText;
MainForm.Font.Height := -11;
MainForm.Font.Name := 'MS Sans Serif';
MainForm.Font.Style := [];
MainForm.PixelsPerInch := 96;

with TRichEdit.Create(MainForm) do
begin
Parent := MainForm;
Align := alClient;
ScrollBars := ssBoth;
HideScrollBars := False;
Text := 'hello there '+Chr(13)+'123'+chr(13)+'456';
SelStart := 0;
SelLength := Length('hello there ');
SelAttributes.Color := clTeal; //Change color
SelStart := SelStart + SelLength + 1;
SelLength := Length('123');
SelAttributes.Style := SelAttributes.Style + [fsBold]; //Set bold
SelStart := SelStart + SelLength + 1;
SelLength := Length('456');
f := TFont.Create;
f.Name := 'courier new'; //Change font
SelAttributes.Assign(f);
f.Free;
SelLength := 0;
end;
end;

procedure ShowFormModal;
begin
MainForm.ShowModal;
end;

var
v: TVariantArray;
begin
v := [];
ThreadSafeCall('InitForm', v);
ThreadSafeCall('ShowFormModal', v);
FreeForm(MainForm);
end.


Because SCAR doesn't have the name property in SelAttributes you have to do it this way.

If you use a TFontDialog, you don't need the extra variable:


program New;
var
MainForm: TForm;

procedure InitForm;
begin
MainForm := CreateForm;
MainForm.Width := 400;
MainForm.Height := 400;
MainForm.Caption := 'MainForm';
MainForm.Color := clBtnFace;
MainForm.BorderIcons := [biSystemMenu];
MainForm.BorderStyle := bsSingle;
MainForm.Font.Color := clWindowText;
MainForm.Font.Height := -11;
MainForm.Font.Name := 'MS Sans Serif';
MainForm.Font.Style := [];
MainForm.PixelsPerInch := 96;

with TRichEdit.Create(MainForm) do
begin
Parent := MainForm;
Align := alClient;
ScrollBars := ssBoth;
HideScrollBars := False;
Text := 'hello there '+Chr(13)+'123'+chr(13)+'456';
SelStart := 0;
SelLength := Length('hello there ');
SelAttributes.Color := clTeal;
SelStart := SelStart + SelLength + 1;
SelLength := Length('123');
SelAttributes.Style := SelAttributes.Style + [fsBold];
SelStart := SelStart + SelLength + 1;
SelLength := Length('456');
with TFontDialog.Create(MainForm) do
begin
if Execute then
SelAttributes.Assign(Font);
Free;
end;
SelLength := 0;
end;
end;

procedure ShowFormModal;
begin
MainForm.ShowModal;
end;

var
v: TVariantArray;
begin
v := [];
ThreadSafeCall('InitForm', v);
ThreadSafeCall('ShowFormModal', v);
FreeForm(MainForm);
end.


Notice how you can set pretty much everything at once with the assign procedure in combination with a TFont?

ShowerThoughts
03-31-2008, 02:33 PM
Why would you use a scar notepad?

Dumpin
03-31-2008, 05:45 PM
because it owns? and you could always add your own cool stuff to it aye? :D

Da 0wner
04-10-2008, 03:15 AM
ehh, can anyone post any suggustions i can make anything you need....? and this isn't current version still working on my alpha version (not beta) i won't release until beta so you guys test. but dan is already working on and it's pretty cool so far :)

nielsie95
04-10-2008, 06:27 AM
Did it work out with the font style for the selected text?

Da 0wner
04-10-2008, 07:05 AM
yep it did nielse thanks :) i added a lot more stuff but its not released yet :). the uploaded one is teh shizzy 1