 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Andrea Raimondi Guest
|
Posted: Sat Oct 08, 2005 7:33 pm Post subject: Designing the GUI |
|
|
Hello.
Nope, this post isn't OT here, in fact we've always said that forms are
classes at heart, this is a very good occasion to prove it .
My problem is indeed on the organizational side, rather than
"apparel" one.
Let me explain: I'm building an HTML editor, using SynEdit v2.
I originally decided that the best way to handle this was to have a
TSynEdit, TMultiSyn(for multi-highlight) and highlighters in a
frame that would be embedded in another one which would in turn be
created inside a TTabSheet.
I am now thinking, though, that certain files might be opened
singularly(like CSS ones or JavaScript, etc) and that there's no
"standard" expression marking begin and end of those files, while the
TMultiSyn component requires a begin/end expression block.
The challenge, then, is to find a way to allow single file types to be
edited, while still making it possible to access the TMultiSyn
facility.
All this, obviously, without creating a TSynEdit frame and
inheriting for each highlighter, plus a frame for *all* highlighters,
which seems a waste to me.
Any ideas?
Andrew
|
|
| Back to top |
|
 |
Bob Dawson Guest
|
Posted: Mon Oct 10, 2005 1:15 pm Post subject: Re: Designing the GUI |
|
|
"Andrea Raimondi" wrote
| Quote: | The challenge, then, is to find a way to allow single file types to be
edited, while still making it possible to access the TMultiSyn
facility.
|
First, don't edit the user's file, when you get a file name, copy it to a
temp file and open that instead. You can save back to the main file on the
user's acceptance.
Now, in the file copy you can have a preprocess and post-process step. Use a
file processor class to do whatever needs done to 'fix-up' the source for
editing, and to reverse that on save.
bobD
|
|
| Back to top |
|
 |
Gerard Guest
|
Posted: Tue Oct 11, 2005 8:18 am Post subject: Re: Designing the GUI |
|
|
En/na Andrea Raimondi ha escrit:
| Quote: | Hello.
The challenge, then, is to find a way to allow single file types to be
edited, while still making it possible to access the TMultiSyn
facility.
Hi, Andrea. |
Why not use a class to hold all the info you need for an edited file?
Like:
TEditedFile =class(TObject)
procedure Open; virtual;
procedure Save; virtual;
property Changed: Boolean;
property FileName: TFileName;
end;
TJavascriptFile =class(TEditedFile)
procedure Open; override;
end;
THTMLFile =class(TEditedFile)
procedure Open; override;
end;
TCSSFile =class(TEditedFile)
procedure Open; override;
end;
This would allow you to store needed in about the file (Filename, if it
has been changed, etc...), and a custom Open method for every file type.
Regards,
Gerard.
|
|
| Back to top |
|
 |
Guillem Guest
|
Posted: Tue Oct 11, 2005 1:19 pm Post subject: Re: Designing the GUI |
|
|
Gerard wrote:
| Quote: | En/na Andrea Raimondi ha escrit:
Hello.
|
a little off-topic but, mallorquí?
--
Best regards :)
Guillem Vicens
Dep. Informática Green Service S.A.
www.clubgreenoasis.com
--
in order to contact me remove the -nospam
|
|
| Back to top |
|
 |
Gerard Guest
|
Posted: Tue Oct 11, 2005 3:04 pm Post subject: Re: Designing the GUI |
|
|
En/na Guillem ha escrit:
| Quote: |
a little off-topic but, mallorquí?
|
No, Andorrà. El meu anglés teu un deix insular? ;-)
|
|
| Back to top |
|
 |
Gerard Guest
|
Posted: Tue Oct 11, 2005 3:09 pm Post subject: Re: Designing the GUI |
|
|
En/na Gerard ha escrit:
| Quote: | anglés teu un deix insular?
Perdó: ^té |
|
|
| Back to top |
|
 |
Guillem Guest
|
Posted: Tue Oct 11, 2005 3:35 pm Post subject: Re: Designing the GUI |
|
|
Gerard wrote:
| Quote: | En/na Gerard ha escrit:
anglés teu un deix insular?
Perdó: ^té
|
en/na <--- els catalans solen dir el/la ;)
--
Best regards :)
Guillem Vicens
Dep. Informática Green Service S.A.
www.clubgreenoasis.com
--
in order to contact me remove the -nospam
|
|
| Back to top |
|
 |
Gerard Guest
|
Posted: Tue Oct 11, 2005 3:46 pm Post subject: Re: Designing the GUI |
|
|
En/na Guillem ha escrit:
| Quote: | en/na <--- els catalans solen dir el/la ;)
|
Doncs hi ha un mallorqui infilrtat entre els traductors del Thunderbird ;-)
|
|
| Back to top |
|
 |
Andrea Raimondi Guest
|
Posted: Tue Oct 11, 2005 4:51 pm Post subject: Re: Designing the GUI |
|
|
Bob Dawson wrote:
| Quote: | First, don't edit the user's file, when you get a file name, copy it to a
temp file and open that instead. You can save back to the main file on the
user's acceptance.
|
I like this one, hadn't thought of it
Really sounds cool and after all, I could implement a very basic
versioning system like the one in D2005, doesn't sound bad at all.
| Quote: | Now, in the file copy you can have a preprocess and post-process step. Use a
file processor class to do whatever needs done to 'fix-up' the source for
editing, and to reverse that on save.
|
This sounds good too, I can just create the hightlighter on the fly, or
create several through composition of classes.
Following on both yours and Gerard's ideas, I could actually something
like this(only declarations for brevity):
Type
TEditedFile = class
protected
procedure PreProcess(FileName : String);virtual;abstract;
procedure PostProcess(FileName : String);virtual;abstract;
function CreateHighlighter :
TCustomSynEditHighlighter;virtual;abstract;
public
destructor Destroy;override;
procedure Load(FName : String);virtual;
procedure Save(ANewFileName : String = '');
property Highlighter : TCustomSynEditHighlighter read FHighlighter;
property SynEdit : TCustomSynEdit;
end;
TBasicEditedFile = class( TEditedFile )
protected
procedure PreProcess(FileName : String);override;
procedure PostProcess(FileName : String);override;
end;
Then all the single classes that make up a single file type.
This sounds both interesting and easy expandable, since I could
then have a list class which would hold the several types along
with the dotless extension, which would allow me to make it
easier to add new file types without coding too much(I would
just need to add 5-10 lines of code more without touching the
interface, which actually sounds good ).
How about this?
Andrew
|
|
| Back to top |
|
 |
Andrea Raimondi Guest
|
Posted: Wed Oct 12, 2005 6:52 am Post subject: Re: Designing the GUI |
|
|
x@x.x wrote:
| Quote: | Jeps, en meget spændende tråd. Tak for de gode ideer. Dog dag (o;
/Brian
|
Someone please cancel this branch from Guillem message on. :D
Andrew
|
|
| Back to top |
|
 |
Guest
|
Posted: Wed Oct 12, 2005 6:56 am Post subject: Re: Designing the GUI |
|
|
Jeps, en meget spændende tråd. Tak for de gode ideer. Dog dag (o;
/Brian
|
|
| Back to top |
|
 |
Guillem Guest
|
Posted: Thu Oct 13, 2005 2:07 pm Post subject: Re: Designing the GUI |
|
|
Andrea Raimondi wrote:
| Quote: | x@x.x wrote:
Jeps, en meget spændende tråd. Tak for de gode ideer. Dog dag (o;
/Brian
Someone please cancel this branch from Guillem message on. :D
Andrew
|
hey! why me???? <g>
--
Best regards :)
Guillem Vicens
Dep. Informática Green Service S.A.
www.clubgreenoasis.com
--
in order to contact me remove the -nospam
|
|
| Back to top |
|
 |
Andrea Raimondi Guest
|
Posted: Thu Oct 13, 2005 4:07 pm Post subject: Re: Designing the GUI |
|
|
Guillem wrote:
Cuz you started it.
Won't reply more in this branch.
Andrew
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|