Update for Onetastic: Favorites and Custom Styles
FavoritesLast update introduced a mini feature: Pin to Desktop. This was a button on the ribbon that would create a link to the current page on desktop. Favorites is an extension of that. The button is now what we call a split button, which has a top part to do the one-click action and the bottom part which is a menu:
Let's start with the menu and what the button does will be obvious after that. The menu allows you to select where to pin the shortcut: Desktop, as before, Favorites menu, or some other location. You can switch between them and the button will reflect this:
You can click on Browse... and then select a folder of your choice and that will appear in the list. If "Desktop" is selected, the feature will work as before and clicking the Pin to button will create a shortcut to the current page on the desktop. If you selected a folder via Browse... then the shortcut will be created there instead. (You can then create a toolbar for that folder in your taskbar for easy access). If you select "Favorites Menu" then the shortcuts will be placed in the Favorites part of the menu.
The favorites menu is a convenient way to access your frequent pages (or sections) and you can keep adding things there as you like. If you want to remove or rename the menu items, click on the Manage Favorites button at the bottom of the menu and that will open up the folder where these are stored, which is %AppData%OnetasticFavorites:
You can then delete or rename items here. If you already had pinned pages on your desktop you can move them here if you want them in your Favorites menu.
Finally a small feature is added to the top of this menu: Pin this Section. You can pin a shortcut to the current section, just like for pages, to either Desktop, Favorites Menu or to the folder of your choice. All of this will hopefully satisfy all kinds of scenarios about accessing your content faster.
Custom StylesSecond feature that is coming with this update is Custom Styles. I must admit that I didn't expect such a feature to be this complicated, as it took a lot of time to get it right. To give some idea, I wrote the favorites feature in an afternoon, whereas custom styles probably took more than two weeks. Also along the way I found several OneNote bugs, which is great because this gives us a chance to fix them.
Anyway, let's talk about styles in OneNote. I do not care much about formatting in OneNote, as it is usually a place for me to capture information quickly and focus on content rather than style. For instance I am writing this post in OneNote but not formatting it there, once I am done with it I will then format it elsewhere for the website. Maybe for this reason, the style support in OneNote is very basic. There is a styles gallery which has a fixed number of styles and you cannot customize them or add new ones:
For instance I want to use "Code" style, which has a fixed-width font, but I don't like Courier New, I prefer Consolas, which means I can't use it because I cannot customize it. Word has extensive customizable styles feature and some people really want to have it in OneNote. Enter Custom Styles:
Another reason I decided to implement this feature was that it would go deep inside manipulating page content and I haven't done that before in an add-in. Image features like crop or rotate, is somewhat related but they deal with a very specific content type. Formatting in OneNote has a lot of components like font, color, bold/italic/underline/strikethrough, bullets/numbering, alignment, subscript/superscript, highlight and paragraph spacing. So Custom Styles feature is a way to capture a set of formatting applied to a piece text and then reusing it later.
The way you create new custom styles is this: You first style a piece of text as you want, then click on Custom Styles > Save Selection as Custom Style, which will display the following dialog:
First, this dialog allows you to give your custom style a name. You can also select a style you previously created and overwrite using the drop down. Second, the dialog shows all the applied style information on the selection and you get to choose which ones you want in the custom style. For instance in this case the selection had bold/italic, left aligned, Calibri 11 red etc. If you only want the style definition to be: Apply bold and italic, and not about the font, color etc. you can deselect all but the Apply Bold and Apply Italic. As you do so, you will see that the preview is updated. For example if you deselect Color (red), then the preview text will turn black. If this whole thing confuses you, you can as well ignore it all together and the results will most likely be fine. Once you are satisfied with your style definition, you can click OK and the new style will be added to the gallery, with the same preview you have seen in the dialog.
I added 17 styles with the installation and I did it all with this dialog. They include my own "Code" style with Consolas font :). I believe the way I implemented the dialog and style definition is very flexible, so you can create a style that only has certain style elements (e.g. just a bullet) and doesn't modify other characteristics of text, though it might be a bit confusing and seem complicated at first. So let me know what you think about this and your ideas on how it can be improved.
I also added Language to the style so you can choose to change the proofing language for the text with a custom style. This can also be used to get rid of red squiggles for things like source code. You can just create a style with Language = some language that you don't have proofing tools installed for, and OneNote will not be able to spell check.
Now that we created some styles, it is time to use them. This is the simple part, you just select some text and choose your style of choice and Onetastic will apply all the paragraph and formatting information you saved before. If you want to delete some of the custom styles you created or is installed by default, you can click on Manage Custom Styles at the bottom of the gallery and the same dialog will appear, but this time with a Delete button. You can select the style you want to delete and click on Delete.
OneNote Bug about Paragraph SpacingI want to also talk about a bug in OneNote that prevented me from including paragraph spacing into this. The dialog shows spacing but it will always be disabled due to this bug. The bug is that OneNote will not tell an add-in about the font information of the text if the text has paragraph spacing applied. This means if you have a piece of text that is styled as Arial 10 red and paragraph spacing: 10 after, 10 before, OneNote will tell me the spacing info but not the font info. In fact it will tell me that the text is Calibri 11 automatic color. This makes things worse when you apply a style to part of a page, because add-in has to write back the whole page when you apply a style and if you have text with paragraph spacing they will be reverted back to Calibri 11. You may hit this if you are using paragraph spacing or if you copied content that has spacing from somewhere else to OneNote, so don't be surprised. If applying a custom style doesn't do what you expect it to do, just let me know and we can identify where the problem is.
One final note is that I did not make use of progress bars in this feature to cover the reading and updating page, as I did in image crop and rotate features, as I expect this to be used in pages that contain mostly text and in that case the operations are quick enough. Let me know if you hit any performance problems.
Well this is all for now, enjoy the new features. They are results of hard work and I tried to make them easy to use, functional, flexible and pleasing. Thanks go to everyone who gave me ideas and feedback.