Skip to content

Commit

Permalink
Fixed links
Browse files Browse the repository at this point in the history
  • Loading branch information
Petter Hesselberg committed Nov 3, 2017
1 parent 8fcbe5c commit a404d5a
Show file tree
Hide file tree
Showing 34 changed files with 107 additions and 106 deletions.
7 changes: 4 additions & 3 deletions MigrateDocumentation/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ public static void Main()
var length = match.Index + 1 - pos;
sb.Append(text.Substring(pos, length));

string link = match.Value.Substring(1, match.Length - 2);
string innerValue = match.Value.Substring(1, match.Length - 2);
string link = innerValue;
string newName = TransformName(link);
if (fileNames.Contains(newName))
{
Expand All @@ -83,7 +84,7 @@ public static void Main()
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(newName);
Console.ForegroundColor = color;
sb.Append(match.Value).Append(')');
sb.Append(innerValue).Append(')');
}

pos = match.Index + match.Length;
Expand All @@ -92,7 +93,7 @@ public static void Main()

sb.Append(text.Substring(pos));
string newText = sb.ToString();
Console.WriteLine(newText);
File.WriteAllText(docFile.FullName, newText, Encoding.UTF8);
}
}

Expand Down
4 changes: 2 additions & 2 deletions docs/Appendix-A-TextEdit-Command-Index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### Programming Industrial Strength Windows
[« Previous: The End of the Road](Chapter-21-—-The-End-of-the-Road)[Next: Bibliography and Recommended Reading »](Appendix-B-—-Bibliography-and-Recommended-Reading)
### Programming Industrial Strength Windows
[« Previous: The End of the Road](Chapter-21-The-End-of-the-Road)[Next: Bibliography and Recommended Reading »](Appendix-B-Bibliography-and-Recommended-Reading)
# Appendix A: TextEdit Command Index

|| Command || Description || Location || Accelerator ||
Expand Down
4 changes: 2 additions & 2 deletions docs/Appendix-B-Bibliography-and-Recommended-Reading.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### Programming Industrial Strength Windows
[« Previous: TextEdit Command Index](Appendix-A-—-TextEdit-Command-Index)
### Programming Industrial Strength Windows
[« Previous: TextEdit Command Index](Appendix-A-TextEdit-Command-Index)
# Appendix B: Bibliography and Recommended Reading

|| _2008 update: Some of these recommendations are a bit outdated. I'll update this page when I get some spare time._ ||
Expand Down
4 changes: 2 additions & 2 deletions docs/Chapter-1-The-Road-Ahead.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### Programming Industrial Strength Windows
[« Previous: Introduction](Introduction)[Next: Designing for Users »](Chapter-2-—-Designing-for-Users)
### Programming Industrial Strength Windows
[« Previous: Introduction](Introduction)[Next: Designing for Users »](Chapter-2-Designing-for-Users)
# Chapter 1: The Road Ahead

This book is the story of a Windows application. I considered several alternatives for this application, and eventually landed on TextEdit, a Notepad replacement with a twist in the usability department. This chapter explains the how, the why and the wherefore.
Expand Down
4 changes: 2 additions & 2 deletions docs/Chapter-10-Customization-and-Persistence.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### Programming Industrial Strength Windows
[« Previous: The Main Window](Chapter-9-—-The-Main-Window)[Next: Wait a Moment »](Chapter-11-—-Wait-a-Moment)
### Programming Industrial Strength Windows
[« Previous: The Main Window](Chapter-9-The-Main-Window)[Next: Wait a Moment »](Chapter-11-Wait-a-Moment)
# Chapter 10: Customization and Persistence

Customization and persistence are closely linked. If J. Random Hacker’s customization settings aren’t preserved between sessions, she’ll lose interest very quickly.
Expand Down
4 changes: 2 additions & 2 deletions docs/Chapter-11-Wait-a-Moment.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### Programming Industrial Strength Windows
[« Previous: Customization and Persistence](Chapter-10-—-Customization-and-Persistence)[Next: File I/O »](Chapter-12-—-File-I_O)
### Programming Industrial Strength Windows
[« Previous: Customization and Persistence](Chapter-10-Customization-and-Persistence)[Next: File I/O »](Chapter-12-File-I-O)
# Chapter 11: Wait a Moment

Before I get into potentially time-consuming operations such as File I/O and printing, I’ll digress into the subject of the wait cursor. I’ll describe a problem with the typical implementation, and discuss enhancements to the standard hourglass.
Expand Down
4 changes: 2 additions & 2 deletions docs/Chapter-12-File-I-O.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### Programming Industrial Strength Windows
[« Previous: Wait a Moment](Chapter-11-—-Wait-a-Moment)[Next: About Dialogs »](Chapter-13-—-About-Dialogs)
### Programming Industrial Strength Windows
[« Previous: Wait a Moment](Chapter-11-Wait-a-Moment)[Next: About Dialogs »](Chapter-13-About-Dialogs)
# Chapter 12: File I/O

Figure 14 gives the highlights of how TextEdit handles files. On opening the file sample.txt, TextEdit immediately creates a copy of the file. In the figure, this copy is labeled “original copy of sample.txt,” but in fact, the name is a pseudo-garbage string generated by GetTempFileName, for example “te0123.tmp.”
Expand Down
8 changes: 4 additions & 4 deletions docs/Chapter-13-About-Dialogs.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
### Programming Industrial Strength Windows
[« Previous: File I/O](Chapter-12-—-File-I_O)[Next: File Management »](Chapter-14-—-File-Management)
### Programming Industrial Strength Windows
[« Previous: File I/O](Chapter-12-File-I-O)[Next: File Management »](Chapter-14-File-Management)
# Chapter 13: About Dialogs

The logical continuation of the TextEdit story is really Chapter 13, File Management. That subject, however, involves dialog boxes. Let’s ease into the subject of dialog boxes through some easy ones, such as the About dialog and the Options dialog (and defer file management to [Chapter 14](Chapter-14-—-File-Management)).
The logical continuation of the TextEdit story is really Chapter 13, File Management. That subject, however, involves dialog boxes. Let’s ease into the subject of dialog boxes through some easy ones, such as the About dialog and the Options dialog (and defer file management to [Chapter 14](Chapter-14-File-Management)).

## What is a Dialog Box, Anyway?

Expand Down Expand Up @@ -166,6 +166,6 @@ What happens if we disable the IDC{"_"}APPLY button, but omit the gotoDlgItem( I

One of the possible flag parameters to the MessageBox function is MB{"_"}NOFOCUS, which ensures that no button has the initial focus. This is useful if you want to protect the MessageBox against accidental dismissal. To create a really obnoxious dialog box, let it respond to all WM{"_"}COMMAND messages with SetFocus( 0 ).

The most complex examples of dialog interaction that TextEdit has to offer are the Find and Replace dialogs, described in [Chapter 15](Chapter-15-—-Search-and-Replace).
The most complex examples of dialog interaction that TextEdit has to offer are the Find and Replace dialogs, described in [Chapter 15](Chapter-15-Search-and-Replace).

[Sidebar: Default Buttons and Multi-line Edit](Sidebar_-Default-Buttons-and-Multi-line-Edit)
4 changes: 2 additions & 2 deletions docs/Chapter-14-File-Management.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### Programming Industrial Strength Windows
[« Previous: File Management](Chapter-13-—-About-Dialogs)[Next: Search and Replace »](Chapter-15-—-Search-and-Replace)
### Programming Industrial Strength Windows
[« Previous: File Management](Chapter-13-About-Dialogs)[Next: Search and Replace »](Chapter-15-Search-and-Replace)
# Chapter 14: File Management

File management in the context of TextEdit is the management of a single file. It includes the ability to change file attributes such as the read-only flag, it includes renaming and repositioning of the file, and it includes deleting the file (and, incidentally, closing TextEdit).
Expand Down
8 changes: 4 additions & 4 deletions docs/Chapter-15-Search-and-Replace.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### Programming Industrial Strength Windows
[« Previous: File Management](Chapter-14-—-File-Management)[Next: Printing »](Chapter-16-—-Printing)
### Programming Industrial Strength Windows
[« Previous: File Management](Chapter-14-File-Management)[Next: Printing »](Chapter-16-Printing)
# Chapter 15: Search and Replace

Windows offers a common dialog for straight searching and for search and replace. I have a strong dislike for this dialog. I dislike the modelessness of it, I dislike the simple edit field for the search string, and I dislike the dim-witted way it paints a default border on a disabled button (see Figure 22). Above all, I dislike the API, which is an invitation to spread related functionality around all the dark corners of a program.
Expand Down Expand Up @@ -32,7 +32,7 @@ One solution to this user interface glitch would be to catch the Enter key and a

Actually implementing this functionality was more of a puzzle than I had expected, chiefly because the combobox notifications are peculiar. The CBN{"_"}DROPDOWN notification is sent before the list opens, while its opposite number, the CBN{"_"}CLOSEUP notification, is sent after the list has closed. In other words, the list is always closed at notification time. This precludes an elegant, common solution for all cases, in which I wouldn’t care whether the message was CBN{"_"}DROPDOWN or CBN{"_"}CLOSEUP. Instead, I would just ask the combobox by sending it the CB{"_"}GETDROPPEDSTATE message (using the ComboBox{"_"}GetDroppedState macro from windowsx.h).

At this point, it occurred to me that this problem is not specific to FindDlg, but completely general. I removed all this code from FindDlg, and instead used global subclassing (as described in [Chapter 4](Chapter-4-—-The-Mechanics-of-Subclassing)) to subclass the dialog window class. The result is in dlgSubclasser.cpp, and has a couple of interesting properties:
At this point, it occurred to me that this problem is not specific to FindDlg, but completely general. I removed all this code from FindDlg, and instead used global subclassing (as described in [Chapter 4](Chapter-4-The-Mechanics-of-Subclassing)) to subclass the dialog window class. The result is in dlgSubclasser.cpp, and has a couple of interesting properties:

* No header file is associated with this file; it has, in a manner of speaking, no interface. The mere existence of the dlgSubclasser static variable is enough to initialize the subclassing.
* The subclassing works on all dialogs within TextEdit, including “system” dialogs such as printer properties.
Expand All @@ -55,7 +55,7 @@ As for all other dialogs, Dialog::dispatchDlgMsg takes care of the initial place

FindDlg has a memory. We’ve already seen how it remembers its position; it also remembers the ten most recently used search strings, the status of the “Match whole word only” and “Match case” checkboxes, and the search direction (up or down).

The list of recently used search strings is read from the registry by the loadStrings method and saved to the registry by the saveStrings method. This “historical combobox” has a close kinship with the list of recently used files discussed in [Chapter 10](Chapter-10-—-Customization-and-Persistence), but is actually simpler in its implementation. How so? In addition to being a GUI component, a drop-down list box (or any list box, for that matter) can also be thought of as part of your data structure. Not only can you put strings into it; you can get them out again as well. Here’s another design principle:
The list of recently used search strings is read from the registry by the loadStrings method and saved to the registry by the saveStrings method. This “historical combobox” has a close kinship with the list of recently used files discussed in [Chapter 10](Chapter-10-Customization-and-Persistence), but is actually simpler in its implementation. How so? In addition to being a GUI component, a drop-down list box (or any list box, for that matter) can also be thought of as part of your data structure. Not only can you put strings into it; you can get them out again as well. Here’s another design principle:

**“Don’t duplicate data storage.”**

Expand Down
4 changes: 2 additions & 2 deletions docs/Chapter-16-Printing.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### Programming Industrial Strength Windows
[« Previous: Search and Replace](Chapter-15-—-Search-and-Replace)[Next: Changing Fonts »](Chapter-17-—-Changing-Fonts)
### Programming Industrial Strength Windows
[« Previous: Search and Replace](Chapter-15-Search-and-Replace)[Next: Changing Fonts »](Chapter-17-Changing-Fonts)
# Chapter 16: Printing

In one sense, printing under Windows is similar to displaying stuff on the screen: You use GDI commands to draw text and graphics in a display context. You don’t obtain (or release) a printer display context the same way you obtain a screen display context, but once you have that display context, you use the same familiar set of GDI functions.
Expand Down
4 changes: 2 additions & 2 deletions docs/Chapter-17-Changing-Fonts.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### Programming Industrial Strength Windows
[« Previous: Printing](Chapter-16-—-Printing)[Next: Going Abroad »](Chapter-18-—-Going-Abroad)
### Programming Industrial Strength Windows
[« Previous: Printing](Chapter-16-Printing)[Next: Going Abroad »](Chapter-18-Going-Abroad)
# Chapter 17: Changing Fonts

TextEdit allows the user to select one proportional font and one fixed-width font. These selections are global across all instances of TextEdit, but it is quick to switch between proportional and fixed-width font, and the selected font is retained for individual files and for file types.
Expand Down
4 changes: 2 additions & 2 deletions docs/Chapter-18-Going-Abroad.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### Programming Industrial Strength Windows
[« Previous: Changing Fonts](Chapter-17-—-Changing-Fonts)[Next: Meanwhile, in the Background »](Chapter-19-—-Meanwhile,-in-the-Background)
### Programming Industrial Strength Windows
[« Previous: Changing Fonts](Chapter-17-Changing-Fonts)[Next: Meanwhile, in the Background »](Chapter-19-Meanwhile-in-the-Background)
# Chapter 18: Going Abroad

Even though I’m running the US edition of Windows NT 4 Workstation, I can nevertheless create files with Greek names; my file system is NTFS, so file names are Unicode. The question is – can I display those file names? The answer is – it depends.
Expand Down
2 changes: 1 addition & 1 deletion docs/Chapter-18-Meanwhile-in-the-Background.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
### Programming Industrial Strength Windows
### Programming Industrial Strength Windows

_THIS PAGE IS ORPHANED AND SHOULD BE DELETED_
4 changes: 2 additions & 2 deletions docs/Chapter-19-Meanwhile-in-the-Background.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### Programming Industrial Strength Windows
[« Previous: Going Abroad](Chapter-18-—-Going-Abroad)[Next: Setup, and Down Again »](Chapter-20-—-Setup,-and-Down-Again)
### Programming Industrial Strength Windows
[« Previous: Going Abroad](Chapter-18-Going-Abroad)[Next: Setup, and Down Again »](Chapter-20-Setup-and-Down-Again)
# Chapter 19: Meanwhile, in the Background

Multi-threading is used for many different purposes. In a server application, a typical purpose is to service multiple requests in parallel, while in a client application, a typical purpose is to perform background processing while keeping the user interface responsive.
Expand Down
6 changes: 3 additions & 3 deletions docs/Chapter-2-Designing-for-Users.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### Programming Industrial Strength Windows
[« Previous: The Road Ahead](Chapter-1-—-The-Road-Ahead)[Next: Designing for Programmers »](Chapter-3-—-Designing-for-Programmers)
### Programming Industrial Strength Windows
[« Previous: The Road Ahead](Chapter-1-The-Road-Ahead)[Next: Designing for Programmers »](Chapter-3-Designing-for-Programmers)
# Chapter 2: Designing for Users

From the Unix world comes a text editor named **vi**. It’s powerful and fast – provided you know how to use it. The problem with vi is that it is difficult to learn. A host of keyboard commands must be learned by heart – the user interface doesn’t give you a clue as to what you can and can’t do. The problem is compounded by vi’s several modes – it has different modes for text insertion and text manipulation, for example. The modes are in themselves no disaster, but their invisibility is. Nothing indicates whether your keystrokes will be interpreted as text to be inserted or commands to be executed.
Expand Down Expand Up @@ -47,7 +47,7 @@ The status bar has one big problem in this role: Most people don’t pay it much

**Figure 1: Status bar with a message.** Highlighting makes the user pay attention.

In [Chapter 15](Chapter-15-—-Search-and-Replace), I’ll show you how to do away with message boxes in connection with search and replace.
In [Chapter 15](Chapter-15-Search-and-Replace), I’ll show you how to do away with message boxes in connection with search and replace.

## Robustness

Expand Down
4 changes: 2 additions & 2 deletions docs/Chapter-20-Setup-and-Down-Again.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### Programming Industrial Strength Windows
[« Previous: Meanwhile, in the Background](Chapter-19-—-Meanwhile,-in-the-Background)[Next: The End of the Road »](Chapter-21-—-The-End-of-the-Road)
### Programming Industrial Strength Windows
[« Previous: Meanwhile, in the Background](Chapter-19-Meanwhile-in-the-Background)[Next: The End of the Road »](Chapter-21-The-End-of-the-Road)
# Chapter 20: Setup, and Down Again

Installation and setup of TextEdit is less of a chore than installation and setup of, say, Microsoft Office. TextEdit is distributed as a single file, rather than umpteen zillion. Still, a number of issues must be dealt with, including version control, registry entries, shortcuts to the application and how to uninstall cleanly.
Expand Down
4 changes: 2 additions & 2 deletions docs/Chapter-21-The-End-of-the-Road.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### Programming Industrial Strength Windows
[« Previous: Setup, and Down Again](Chapter-20-—-Setup,-and-Down-Again)[Next: TextEdit Command Index »](Appendix-A-—-TextEdit-Command-Index)
### Programming Industrial Strength Windows
[« Previous: Setup, and Down Again](Chapter-20-Setup-and-Down-Again)[Next: TextEdit Command Index »](Appendix-A-TextEdit-Command-Index)
# Chapter 21: The End of the Road

This is it. We’ve reached the end of the road; TextEdit is done. At least, version 1 of TextEdit is done. There are many things I’d like to change, and there are many features that I’d like to add. In spite of blemishes and imperfections, however, I think the overall design and implementation of TextEdit illustrate my basic arguments. My intention with this book has not been to present TextEdit as an example of a perfect Windows program, but rather to make you think.
Expand Down
4 changes: 2 additions & 2 deletions docs/Chapter-3-Designing-for-Programmers.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### Programming Industrial Strength Windows
[« Previous: Designing for Users](Chapter-2-—-Designing-for-Users)[Next: The Mechanics of Subclassing »](Chapter-4-—-The-Mechanics-of-Subclassing)
### Programming Industrial Strength Windows
[« Previous: Designing for Users](Chapter-2-Designing-for-Users)[Next: The Mechanics of Subclassing »](Chapter-4-The-Mechanics-of-Subclassing)
# Chapter 3: Designing for Programmers

In the previous chapter, I discussed software usability from the user’s point of view. Programmers are users, too, albeit with a different worldview. Programmers, including yourself, are users of your source code.
Expand Down
6 changes: 3 additions & 3 deletions docs/Chapter-4-The-Mechanics-of-Subclassing.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### Programming Industrial Strength Windows
[« Previous: Designing for Programmers](Chapter-3-—-Designing-for-Programmers)[Next: The Bare Bones »](Chapter-5-—-The-Bare-Bones)
### Programming Industrial Strength Windows
[« Previous: Designing for Programmers](Chapter-3-Designing-for-Programmers)[Next: The Bare Bones »](Chapter-5-The-Bare-Bones)
# Chapter 4: The Mechanics of Subclassing

In an ideal world, at least for C++ programmers, Windows would be C++ throughout. Subclassing a window would be a matter of subclassing a C++ class, creating a window would be a matter of invoking the window’s constructor, message handling would be a matter of overriding virtual functions.
Expand Down Expand Up @@ -262,7 +262,7 @@ int APIENTRY WinMain( HINSTANCE hinst, HINSTANCE, LPSTR, int ) {

Thus endeth the subclassing tutorial. That’s all there is to it, really, except for various esoteric techniques used to subclass windows in other processes, which I won’t go into.

The next section presents the code that TextEdit uses to accomplish instance and global subclassing. The code uses other classes that I haven’t described yet. For now, I’ll just use the String and Exception classes without further ado; I’ll go into more detail about them in Chapters [5](Chapter-5-—-The-Bare-Bones) and [6](Chapter-6-—-Exceptions).
The next section presents the code that TextEdit uses to accomplish instance and global subclassing. The code uses other classes that I haven’t described yet. For now, I’ll just use the String and Exception classes without further ado; I’ll go into more detail about them in Chapters [5](Chapter-5-The-Bare-Bones) and [6](Chapter-6-Exceptions).

## General Mechanism for Global Subclassing

Expand Down
Loading

0 comments on commit a404d5a

Please sign in to comment.