157 Replies - 29828 Views - Last Post: 02 March 2009 - 11:13 AM
#11
Re: Snippet Manager
Posted 25 August 2008 - 04:33 AM
Cool, it's a simple but good idea
I like it very much! And it's written with .NET framwork?
#12
Re: Snippet Manager
Posted 25 August 2008 - 04:49 AM
Yep. I've been working with .NET since... Saturday! 
So this is all new to me, but I'm getting there.
Here it is:
Again, kept to see development, but the newest is further down in this post.
Snippet_Manager_0.7.6a.zip (7.5K)
Number of downloads: 92
There are a lot of changes, all for the better. It looks much neater now, there's an about option, all the previous options are under "File" and there's syntax highlighting on the word "test." (I know it's not the right word, but it's a start)
I need to fix some of the syntax highlighting, make it start from the beginning of the current line as opposed to the beginning of the text every time, which will hopefully reduce the flashing.
Again, feedback is welcomed
EDIT:
Here's the latest version. There's some basic C++ syntax highlighting going on, it doesn't highlight it when you load a file yet, but it does it as you type. It scans the text for the current line, so flashing is reduced.
Note that the cursor moves to the end if you type somewhere in the middle of the box at the moment. That's one of the next things that I'll fix
Snippet_Manager_0.8.3a.zip (7.38K)
Number of downloads: 123 <edit> Newer version available here </edit>
Here's a screen shot of the syntax highlighting in action:

I think the next addition will be preprocessor stuff, which makes the whole line a certain colour if there's a '#' at the beginning of the line.
Also, I'll make that stuff bold too, to make it stand out more.
So this is all new to me, but I'm getting there.
Here it is:
Again, kept to see development, but the newest is further down in this post.
Snippet_Manager_0.7.6a.zip (7.5K)
Number of downloads: 92
There are a lot of changes, all for the better. It looks much neater now, there's an about option, all the previous options are under "File" and there's syntax highlighting on the word "test." (I know it's not the right word, but it's a start)
I need to fix some of the syntax highlighting, make it start from the beginning of the current line as opposed to the beginning of the text every time, which will hopefully reduce the flashing.
Again, feedback is welcomed
EDIT:
Here's the latest version. There's some basic C++ syntax highlighting going on, it doesn't highlight it when you load a file yet, but it does it as you type. It scans the text for the current line, so flashing is reduced.
Note that the cursor moves to the end if you type somewhere in the middle of the box at the moment. That's one of the next things that I'll fix
Snippet_Manager_0.8.3a.zip (7.38K)
Number of downloads: 123
Here's a screen shot of the syntax highlighting in action:

I think the next addition will be preprocessor stuff, which makes the whole line a certain colour if there's a '#' at the beginning of the line.
Also, I'll make that stuff bold too, to make it stand out more.
#13
Re: Snippet Manager
Posted 25 August 2008 - 07:57 AM
I think I'm getting the hang of this!
Check out the syntax highlighting:
http://www.dreamincode.net/forums/index.php?act=Attach&type=post&id=8114
Hooray!
Check out the syntax highlighting:
http://www.dreamincode.net/forums/index.php?act=Attach&type=post&id=8114
Hooray!
Attached image(s)
#14
Re: Snippet Manager
Posted 25 August 2008 - 07:59 AM
Alright Good Job!
I'm looking forward to seeing the final result
I'm looking forward to seeing the final result
#15
Re: Snippet Manager
Posted 25 August 2008 - 08:11 AM
Well, I'm getting there slowly but surely 
Next up, I suppose it's quotes, so I can get something like
Next up, I suppose it's quotes, so I can get something like
"This is all a single colour";
#16
Re: Snippet Manager
Posted 25 August 2008 - 08:31 AM
Horay!!! In the image there was spacing. Did you type that yourself or is automatic in it?
#17
Re: Snippet Manager
Posted 25 August 2008 - 08:49 AM
I typed it myself, but I'm gonna work with that next
#18
Re: Snippet Manager
Posted 25 August 2008 - 10:40 AM
Got another update!
abgorn, this is just for you. Indentation!
It might need a bit of work, but it's certainly there.
This is how it looks:
http://www.dreamincode.net/forums/index.php?act=Attach&type=post&id=8116
I didn't indent any of it myself, that was all done automatically.
I think it's time to share some code, as a sneak preview:
I'll upload the latest version with indentation in a minute, I just gotta compress it.
abgorn, this is just for you. Indentation!
It might need a bit of work, but it's certainly there.
This is how it looks:
http://www.dreamincode.net/forums/index.php?act=Attach&type=post&id=8116
I didn't indent any of it myself, that was all done automatically.
I think it's time to share some code, as a sneak preview:
void indent ()
{
try
{
if (code.Text[code.Selectionstart-2] == '{' && code.Text[code.Selectionstart-1] == '\n')
{
tabs++;
for (int i = 0; i < tabs; i++)
code.AppendText (" ");
}
if (code.Text[code.Selectionstart-2] == '}' && code.Text[code.Selectionstart-1] == '\n')
{
code.Selectionstart -= 5;
SendKeys.Send("{DELETE}{DELETE}{DELETE}{RIGHT}{RIGHT}");
tabs--;
}
if (code.Text[code.Selectionstart-2] != '{' && code.Text[code.Selectionstart-1] == '\n')
for (int i = 0; i < tabs; i++)
code.AppendText (" ");
} catch (System.Exception t) {}
}
I'll upload the latest version with indentation in a minute, I just gotta compress it.
Attached image(s)
#19
Re: Snippet Manager
Posted 25 August 2008 - 10:53 AM
Thanks for the snippet, I plan to use something like it in my Java project nText of that's ok (it's a simple text editor/note taker app).
#20
Re: Snippet Manager
Posted 25 August 2008 - 10:57 AM
Sure, no problem 
Here's the newest version:
Snippet_Manager_0.8.854a.zip (7.97K)
Number of downloads: 80 <edit>VERSION 1 NOW AVAILABLE HERE!
</edit>
And here's a gift abgorn. Syntax highlighting, basic code:
I have a nasty habit of not commenting my code. Sorry about that.
It isn't the best, it's very flawed. But it's there, all the same.
Here's the newest version:
Snippet_Manager_0.8.854a.zip (7.97K)
Number of downloads: 80
And here's a gift abgorn. Syntax highlighting, basic code:
void colour (System.Drawing.Color a, string [] search, bool bold, int loop)
{
int z; // current caret position, use to reposition after font changes
z = code.Selectionstart;
int i;
try
{for (int x = 0; x < loop; x++)
{
i = code.GetFirstCharIndexFromLine(code.GetLineFromCharIndex(code.Selectionstart + 1));
i = code.Text.IndexOf (search[x], i);
if (i != -1)
{
code.Selectionstart = i;
code.SelectionLength = search[x].Length;
if (code.SelectionColor == System.Drawing.Color.Black) // if it isn't to be overridden
code.SelectionColor = a;
if (bold == true)
code.SelectionFont = new System.Drawing.Font(code.Font, System.Drawing.FontStyle.Bold);
code.DeselectAll();
i += search[x].Length;
}
}
code.Selectionstart = z;
code.SelectionColor = System.Drawing.Color.Black;
code.SelectionFont = new System.Drawing.Font(code.Font, System.Drawing.FontStyle.Regular);
} catch (System.Exception t) {} // do nothing
}
void HandleRed ()
{
string [] search = {"=", "/", "*", "(", ")", "[", "]"};
colour (System.Drawing.Color.Red, search, false, 7);
}
void HandleBlue ()
{
string [] search = {"using", "namespace", "void", "int", "bool", "char", "for", "while",
"do", "try", "catch", "throw", "static", "const", "class", "true",
"false", "return", "this", "if", "else"};
colour (System.Drawing.Color.Blue, search, true, 21);
}
void HandleGreen ()
{
try
{// get the first character of the line
int pos = code.GetFirstCharIndexFromLine(code.GetLineFromCharIndex(code.Selectionstart + 1));
if (code.Text[pos] == '#')
code.SelectionColor = System.Drawing.Color.Green;
char current = code.Text[code.Selectionstart-1];
if (current == '\n')
code.SelectionColor = System.Drawing.Color.Black;
}catch (System.Exception t) {}
}
I have a nasty habit of not commenting my code. Sorry about that.
It isn't the best, it's very flawed. But it's there, all the same.
#21
Re: Snippet Manager
Posted 25 August 2008 - 11:56 AM
Thanks for the gift of code. So what gave you the idea to make the manager in the first place?
#22
Re: Snippet Manager
Posted 25 August 2008 - 12:01 PM
Can I take a stab at it and say bordem?
#23
Re: Snippet Manager
Posted 25 August 2008 - 12:02 PM
I was getting frustrated with having too many snippets, and not being able to organise them and access them through a simple-to-use program. Obvious, right?
Anyway, my next idea is to make it possible to dump the contents of the clipboard into a new folder, under a "clipboard" parent node on the tree menu. Maybe an auto dump, which only saves them for a few days~ the user can specify how many, or delete them when necessary. The feature could also be turned on/off.
Sound good?
Anyway, my next idea is to make it possible to dump the contents of the clipboard into a new folder, under a "clipboard" parent node on the tree menu. Maybe an auto dump, which only saves them for a few days~ the user can specify how many, or delete them when necessary. The feature could also be turned on/off.
Sound good?
#25
Re: Snippet Manager
Posted 25 August 2008 - 12:15 PM
Mmmm, it sounds good and do you mean a visual clipboard or the system clipboard?

New Topic/Question
Reply




MultiQuote






|