Removed the Version 1.0 since there is newer one.
original:
Simple Text Editor V1.0 is based on RichEdit 2.0. The reason for this project is not to develop a text editor software. I'll integrate it to another project. It is practical to develop and test a project in parts.
Currently, following basic functions were implemented: "File open, file save, file save as, file close, redo, undo, cut, copy, paste, find, find-replace." Some functions implemented differently although richedit has alternative (such as clipboard functions and stream in/out for file read/write).
I will add more functions in feature versions including print, font selection etc.
The project folder (ppj, c, h etc included) is attached. Comments, contribution and feedbacks are welcomed.
Thanks, nice little project that might come in handy for others... :D
Ralf
New version of Simple Text Editor is attached (V1.1.a)
What changes are (as summary):
1. cleaned c, h and rc files and removed dead code. (also changed the structure)
2. Changed local cut-copy-paste functions to clipboard operations
3. Added New File, Print, Recent Files (last 10 files), Delete, Select All, Change case functions
4. Added a status bar that displays file name with path
5. Added a tool bar with New File, File Open, File Save, Cut, Copy, Paste, Undo, Redo, Find, Replace
6. Added menu seperators to Edit menu
7. Added more shortcuts (common)
8. Added context menu with Cut, Copy, Paste, Delete and Select All functions
It is not a good idea to add/change standard include files.
standard include files and libraries were not changed. if you refer to "cleaned c, h and rc files" statement, changed files are
simpletexteditor.c
simpletexteditor.h
simpletexteditor.rc
Better to use standard headers in normal way:
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <windowsx.h>
#include <commctrl.h>
#include <Commdlg.h>
#include <tchar.h>
#include <richedit.h>
#include <stdlib.h>
#include <strsafe.h>
#include <tgmath.h>
and why just not using __int64 or long long ?
Nice project :)
Minor glitches:
- Ctrl V pastes clipboard content twice.
- Opens RTF files in rich mode but saves plain text, i.e. formatting gets lost.
Pelles C says 3*unreachable code; 42,496 bytes without debug info is OK but could be condensed a bit (for comparison: TinyIDE is a 7.0 kBytes editor (http://masm32.com/board/index.php?topic=103.0))
Thanks for the feedbacks. It is interesting that ctrl v pastes content twice but shift insert, toolbar icon, edit menu and context menu act as they supposed to.
Commented ctrl v assignment from the accelerator table of rc file, it works normally. I think ctrl v works twice. I'll look into it. I'll also look into rtf files format change.
Yes, 3 unreachable areas reported but looks no problem in operation. I'll to try to find out reason.
Note to timovjl:
I use MS Visual Studio, just started Pelle's C. And compiler states that _int64 is undefined. It is my preference to stay with _int64 rather than using long long.
Quote from: tanel on July 03, 2013, 08:35:59 PM
I use MS Visual Studio, just started Pelle's C. And compiler states that _int64 is undefined. It is my preference to stay with _int64 rather than using long long.
_int64 is not standard C, PellesC have __int64 (2 underscores) as Timovjl has wrote (look better his post).
You can make your code compatible with both compilers using:
#ifdef __POCC__
typedef __int64 _int64;
#endif
Quote from: tanel on July 03, 2013, 08:35:59 PMCommented ctrl v assignment from the accelerator table of rc file, it works normally. I think ctrl v works twice.
The RichEd control handles Ctrl C/X/V by default, therefore no need for an accelerator.
Now, I understood what Timovjl meant. "(2 underscores)" made clear.
Tanel,
This is a nice project. Be aware, though, that the RichEdit control is a pig - it has some really nasty bugs, and badly documented behaviour. PM me if you are stuck with weird behaviour; I have written 15,000 lines for RichMasm (http://www.masmforum.com/board/index.php?topic=9044), and found workarounds for quite a number of bugs.
You can also search the Masm32 forum (http://masm32.com/board/index.php) for the term RichEdit - there are 31 threads dealing with it, as compared to only two here.
Thank you jj2007. I'll check masm32 forum.
In the meantime, I realized that StringCbCopy causes "unreachable code" warnings.
Taking the comments and feedbacks into consideration, updated version of the project is attached. Major difference is file read and write mechanism. In order to keep rich format during file save, streamout was implemented.
Change summary between V1.1a and V1.2a
1. Added open/save in rtf (file read & write approach completely changed)
2. Fixed "ctrl v paste twice" issue
3. Fixed New File and Close File problems
4. Added text mode information in status bar
5. Added font parameters dialog to change font type, color, size, style
6. Fixed context menu, toolbar and main menu enable/disable issues
7. Enabled printer dialog box
8. Added "content change" check to Close button of System Menu
(My goal was to have basic plain text editor but turned out to be more functional. )
Removed attachment due to availability of new version
And there is even a box saying "you made changes, wanna save?"
Keep up the good work :)
In parallel with my main project, updated the Simple Text Editor to have MDI support. New version is attached as project file.
Change Log summary between V1.2a and V2.0a
1. Implemented multiple document support with tab control (reason for the major change in version).
So that, more than one document can be opened, edited, created.
2. Added Caps Lock detection and display in the status bar.
3. Added Insert / Over Write mode detection and display in the status bar.
4. Added drag&drop feature to open a document. (file can be opened by dropping its icon onto application icon)
5. Added Windows menu item to main menu to support MDI
6. Added help function with a menu item
7. Added tip for the tool bar icons