December 01, 2024, 11:07:50 AM

News:

IWBasic runs in Windows 11!


Tpad - A Text Editor

Started by h3kt0r, February 09, 2020, 07:59:23 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

h3kt0r

February 09, 2020, 07:59:23 AM Last Edit: February 18, 2020, 03:04:20 AM by h3kt0r Reason: Update
This is the follow up to the "Gutter Custom Control" thread started in the "General Questions" section.
Thought it would make sense to move here for updates to the text editor i'm working on.

Up to that point, i had mitigate succes in implementing the "Find/Replace" common dialog.
The "Find" function is working, the "Replace" function too. But i still have to write the
"Replace All" function and manage the "Whole word" option correctly. I disabled the "Search
Up" option to ease the whole thing a little bit.

This is a slightly improved version, far from finished. Anyway, i'm sharing the source.

See attached ZIP archive.

Brian

You don't seem to be using a resource (.rc) script for your images and icons. Is this by design, 'cos I am a bit lost with this! You are using resource-like names for images, etc, that have different names to what you are trying to load

Brian

h3kt0r

All apologies, i actually forgot to join the ".rc" file.
Updated ZIP with needed file, see attachment in first post...

h3kt0r

For those whom might be interested, i'm not compiling from a floppy disk :
"A:\" path in the resource file points to a RAM disk on my system.
Main advantage gained from compiling on a RAM disk is speed...

Brian

OK, that fixed the bitmaps and icons problem, but I still can't get it to open an actual file!

Brian

h3kt0r

February 10, 2020, 06:25:27 AM #5 Last Edit: February 10, 2020, 06:27:18 AM by h3kt0r
Oops ! "Unexpected bug !"

You're absoluteky right.

Something messed up in the 'DoOpen()' subroutine :
'¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
' Open file
'¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
SUB DoOpen(fName:String)
IF fName = "" THEN fName = FileRequest("Open File",WIN,1,Filter$,"txt")
MESSAGEBOX(win,fName,"File", 0 | 80)
 if(len(fName) > 0)

 buffer = ""
 if(openfile(fHdl,fName,"R") = 0)
 do
 if(read(fHdl,ln) = 0)
 buffer = buffer + ln + chr$(13) + chr$(10)
 endif
 until eof(fHdl)
 FSIZE = LEN(fHdl)
 closefile fHdl
 newname = fName : mruArray()
 CONTROLCMD WIN, STATUS_1, @SWSETPANETEXT, 1, STR$(FSIZE) + " bytes"
 SETCAPTION WIN, "Tpad - [" + fName + "]"
 setcontroltext win,EDIT_1,buffer
 SETFOCUS WIN,EDIT_1
 endif
 ELSE
 RETURN
 endif

RETURN
endsub

For some obscure reason, the 'Filerequest' dialog does not return the selected file name.
:/ Ahem. Actually looking to fix this...

Brian

Nope - that doesn't work, either

Brian

h3kt0r

Bug fixed.
See attached ZIP archive in first post.

h3kt0r

February 11, 2020, 04:35:21 AM #8 Last Edit: February 11, 2020, 06:53:03 AM by h3kt0r
Updated :

+ Status bar now displays CAPS, INS and NUM keys state (ON/OFF)
+ Status bar now displays tips associated with menu items
+ The program now load a file passed on the command line
+ The program now load a file dropped on its window
+ The program now handles correctly printing files

See first post for attached ZIP archive.

h3kt0r

Updated :

+ Added "Goto Line" controls
+ Redone status bar
+ First 64Kb chunk of a large file is quickly loaded as "read-only"
+ The program now saves its screen position to INI file

Brian

Looking good, Hector

Why not put a STARTTIMER to handle the Statusbar messages with, say an amount of 50ms? You wouldn't then have to wait up to 1 second for a message to appear, as is happening now

Brian

h3kt0r

February 15, 2020, 03:44:58 PM #11 Last Edit: February 15, 2020, 09:53:10 PM by h3kt0r
Shortened the timer delay to 250ms and turned the "Goto Line" buttons to ownerdraw.

+ Added a ruler

As usual, see first post to download the updated version.

h3kt0r

Update :

+ subclassed the ruler in its own window
+ Added a line marker to always know which line the cursor is on


Brian

February 17, 2020, 05:38:26 AM #13 Last Edit: February 17, 2020, 06:13:35 AM by Brian
Hector,

I'm not seeing the red marker in the program, even though it is in the \res folder. Looks to be a naming issue

BTW, you can make your resource file more portable by simply having an entry as: 16x16 ICON "res\\small.ico" - missing out the full path

Brian

PS: Fixed it now

h3kt0r

Well, thank you for the resource file tip, this is something i didn't knew.
I was tinkering with the binary icons, wondering why explorer displayed the small icon (16x16) even
with "Icons" or "Tiles" view activated.
Now, i understood that giving names to icon resources is not suitable.
So, i've replaced these by numbers in the source and resource files.
Also joined the binary to the ZIP archive.

Andy

Hecktor,

That's great work you are doing, as stated before, please don't think I am in competition with you - what I am doing is something a little different to you.

Keep up the work.

See my last post:
http://www.ionicwind.com/forums/index.php?topic=6370.msg46621;topicseen#msg46621

Andy.
:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Brian

Hector,

Tidied up your code a little bit. Removed some unneeded code; added a second timer for the INS, NUM, etc, keypresses; kept the TIME$ at 1000ms; taken out the RETURNs next to the ENDSUBS. You don't need a return there unless it is actually returning something

It now compiles cleanly, as well

Brian

h3kt0r

Thank you Brian, there's a bunch of warnings that just went away.
Andy, that's okay, i know you're working hard on your project. This is something else, entirely.

Well, i've just added an "About box" to the program.
Let's call it a day !

Brian

Liked the About box - very stylish!

Are you using a compression program on the final Tpad.exe? The exe you posted is smaller than the source code! And my anti-virus didn't like it at all - wouldn't let it run. That can happen a lot with compressed exes

My compiled exe is 184kb, and yours is 54kb - big difference

Brian

h3kt0r

Unfortunately, i can't keep this "About box" as it is. When you click on the main program window scroll bars
while the "About box" is displayed, there is a side effect : you can't close it anymore. Try by yourself,
you'll see what i mean.
Had to change it from WINDOW to DIALOG.

And, yes, i use UPX to compact executables.
I barely use my antivirus. Most of the time, it detects perfectly legitimate programs to be some kind of threat.
And anti-virus programs are a heavy load on system resources. This is not acceptable : false positives + system
heavy load are just turning me off.
Whenever in doubt, i start the anti-virus and use on demand scan on the suspect file.


Brian

I have tried UPX before. If you put in a high value for the compression, a lot of programs just wouldn't run. And you must be using a tight compression value to get it from 184kb to 54kb - that's two-thirds!

I could see the point yonks ago, when RAM and disk space was at a premium, but it doesn't hold water now to compress programs so aggressively

Just my thoughts . . .

Brian

h3kt0r

February 18, 2020, 04:42:13 AM #21 Last Edit: February 18, 2020, 04:58:00 AM by h3kt0r
this is what i type in the console to get that :

UPX --best filename.exe

usually it takes less than 2 seconds to compact the file.

I don't agree with you : else why do you still archive files with ZIP (or RAR, etc...) ?
UPX uses LZMA compression, which is used by ZIP.
What you get, in fact, is a zipped executable which is unzipped into memory space and run from there.
Small is beautiful.

I don't like bloatware. Adobe Acrobat, Microsoft Office, all these very large software that bloat the hard drive
while you can get Sumatra PDF or PolyEdit which only takes a fraction  of the space for the same
basic functionnalities. Mainly : open and read a PDF or a DOC file.
I don't need all the extra stuff that Adobe or Microsoft put into their bloated piece of software.

I rather like a small, fast program that does only one thing but does it correctly than a large, slow
program that does many things (and the coffee) incorrectly.
(and slow is incorrect given the processors we have these days).

Brian

Ok, enough - I just beg to differ. I still like your program, though!

Brian

h3kt0r

Thank you.
Roughly, the roadmap is as follow :

- to finish the find/replace functions ("wholeword" & "replace all" options).
- to add a font selector with a filter for fixed pitch fonts.
- to add a basic file browser docked on the right.
- to add an options dialog.
- to add the capacity to show/hide ruler, gutter, toolbar, file browser via the menu.
- to add ownerdraw menu.

Andy

February 19, 2020, 04:41:12 AM #24 Last Edit: February 19, 2020, 04:43:00 AM by Andy
Hecktor,

You may find this useful to you, I wrote it maybe 2 or 3 years ago, it's a constants search program.

It has 71 categories in it, with over 4,000 constants and values.

MSDN (and other sites) mention constant "XYZ" but not always the value.

Please have a look, scroll down to the end to get the last update I did.

http://www.ionicwind.com/forums/index.php?topic=6257.0

There is also a help file & exe file if you just want to use it.

Hope this is useful to you.

Andy.
:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.