My app works similarly.

As I said, my application originally was a 'generic' note-taking s/w, so I used zipped rtf to store text and pictures (pic of the table).

Unlike your app, I don't have any "Add New Code" form. Every code and 'normal notes' in my app are treated as 'normal notes'. It helps me to store codes+descriptions+screenshots in same place. (But searching becomes a little less accurate. )

When you want to add a new code, you need to manually create the note, select the code and select appropriate syntax file from the "syntax" menu for formatting.