Lightsaber IDE 002: Basic improvements

by Terry Hughes Saturday, April 09, 2011 08:15 PM

Lightsaber IDE

Now that I have something that works, let's make it better!

The first thing I'd like to do is make the feedback cycle better. I had setup a build file initially

REM make.cmd
@ECHO OFF

IF EXIST bin RMDIR bin /S /Q
MKDIR bin

"%windir%\Microsoft.NET\Framework\v4.0.30319\csc.exe" /out:bin\DevPad.exe /target:winexe /recurse:src\*.cs /nologo

@ECHO ON

but I soon realized that a simple mistake would lead to me wiping out my IDE and forcing me to go back to notepad or keep a working copy of the IDE around some other place. Also, I would run the make.cmd and then I'd have to run bin\DevPad.exe. I decided to update the build file to stage the executable and only when the compile succeeds do I overwrite the actual IDE.

REM make.cmd
@ECHO OFF

IF EXIST obj RMDIR obj /S /Q
MKDIR obj

"%windir%\Microsoft.NET\Framework\v4.0.30319\csc.exe" /out:obj\DevPad.exe /target:winexe /recurse:src\*.cs /nologo

IF ERRORLEVEL 1 GOTO :EoF

IF EXIST bin RMDIR bin /S /Q
MKDIR bin

COPY obj\*.* bin >> NUL

@ECHO ON

To make it a one step process I added an upgrade file

REM upgrayedd.cmd
@ECHO OFF

CALL make.cmd
@ECHO OFF
START bin\DevPad.exe

@ECHO ON

For tidiness I added a clean script

REM clean.cmd
@ECHO OFF

IF EXIST obj RMDIR obj /S /Q
IF EXIST bin RMDIR bin /S /Q

@ECHO ON

One annoyance I was running into a lot, was getting prompted with the save dialog AND the confirmation that it was okay to overwrite the specified file when I wanted to save. By storing the file name as a variable I'd be able to know if I'm working on an existing file or something new.

I also wanted to make my IDE smarter. If I wasn't careful I could lose unsaved changes. I wrote the logic of remembering if there were usaved changes and prompt for when there were out in its own class, UnsavedChanges and then wired it up inside MainForm. I don't like how UnsavedChanges has to have a IWIn32Window and Action (the Save() method) but it works for now.

The final bits of improvements I wanted to add are to show the current file on the form, set the default size to 800x600, to start maximized, and to set the default font new Font("Consolas", 10, FontStyle.Regular, GraphicsUnit.Point, 0).

Comments are closed

About Me

TerryH   I'm a senior software developer currently working on a foreign exchange portfolio management system for a financial company with a bunch of awesome people.

Disclaimer

The opinions and viewpoints expressed on this blog are not necessarily those of a cultured, tactful, or well-balanced person. This blog is a product of me, who is solely responsible for its content. Me - Stealing From Smart Developers.

Copyright © 2008-2011 Terry Hughes. All rights reserved.