View Sidebar

A Million Little Pieces Of My Mind

Organica Core: Documents.vb

By: Paul S. Cilwa Viewed: 4/26/2024
Posted: 6/11/2018
Page Views: 721
Topics: #Computers #Organica #Programming #VB.NET
The base class for all Organica documents.

In the previous chapter, we ended by positioning the app to the user directory if started without an argument, or to the specified folder if an argument was supplied. The start directory is a folder, that is, something that contains documents of varying types. Now, this is key: Every folder is, in fact, a Document. It might be a Folder document (a list of documents in the folder) but it might also be a document with text and photos or anything else.

Moreover, there can be specialized Folder types; for example, a photo slideshow or a rock album.

And all of these, whether Folder or other type of Document, are treated the same by Organica: As a Document.

There will be a number of different basic document types we must define; I am putting them all in a single class module, Documents.vb. We'll open it with the list of Imports and some essential types of Document—a list that will grow as the types of Document-derived classes increase.

Documents.vb

Imports System.IO Imports System.Text Enum DocumentTypes organica_Unknown organica_Folder organica_Profile organica_Link ' More types defined here as needed End Enum

In the below pages, we'll examine each type of Document class that lives in this module.

Organica Core: Document class

By: Paul S. Cilwa Posted: 8/3/2018
Page Views: 660
Topics: #Computers #Organica #Programming #VB.NET
The base class for all Organica documents.

The Document class provides the basic functionality for all documents, including being able to create objects of the appropriate document type. It is the base class for all the document types. It also does double duty as the default class for unrecognized document types.

Read more…

Organica Core: ProfileDocument class

By: Paul S. Cilwa Posted: 8/3/2018
Page Views: 656
Topics: #Computers #Organica #Programming #VB.NET
A derived Document class to read .INI files.

When Windows was first introduced, in included a feature then called ".INI" files. These "initialization files" stored user preferences for an application, such as whether or not to display a menu, or what color they want borders to be. Later, the name was changed to "profiles", and then to "private profiles". Finally, the functionality was moved to the System Registry. But the underlying code to parse the values in a profile remains (albeit at an unusually low level); and the files themselves are trivial to create (via Notepad, for example). In addition, since they are associated with a folder that contains them (as Registry entries are not), they actually lend themselves to providing folder information to Organica. In this chapter, then, we shall derive a class from last chapter's Document class, to deal with this type of file.

Read more…

Organica Core: Preparing for First Use

By: Paul S. Cilwa Posted: 8/3/2018
Page Views: 684
Topics: #Computers #Organica #Programming #VB.NET
How to determine if Organica has ever before been run on this computer.

What happens the very first time a user puts his foot in the water, so to speak, and runs Organica? We've already made an effort to "position" the running program so that it is "in" the user's home directory. But Organica needs to be able to create a directory for itself, with at least an INI file with default preferences.

Read more…

Organica Core: LinkDocument class

By: Paul S. Cilwa Posted: 8/3/2018
Page Views: 641
Topics: #Computers #Organica #Programming #VB.NET
A derived Document class to follow shortcuts to a document located elsewhere.

In the Windows environment, it's common to create a "shortcut" to some program or file, perhaps on the Desktop. In most cases, Windows treats a shortcut (called a "link" in earlier versions of Windows) as if it were the file it points to. In the Organica environment, shortcuts work similarly but, of course, they can only point to documents (including Folder documents).

Read more…

Organica Core: FolderDocument

By: Paul S. Cilwa Posted: 8/3/2018
Page Views: 659
Topics: #Computers #Organica #Programming #VB.NET
A derived Document class to represent a Folder (a collection of documents and/or additional folders.

When Organica first starts up, typically it will display contents of the user's root folder. This is the class that understands what a Folder is, and how to display and allow interaction with it.

Read more…