Skip to content

Commit

Permalink
Fixed extensions and images
Browse files Browse the repository at this point in the history
  • Loading branch information
Petter Hesselberg committed Nov 3, 2017
1 parent a404d5a commit 09b4cfc
Show file tree
Hide file tree
Showing 33 changed files with 119 additions and 134 deletions.
27 changes: 6 additions & 21 deletions MigrateDocumentation/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,13 @@ namespace MigrateDocumentation
{
public static class Program
{
private class Replacement
{
Replacement(int start, int length, string value)
{
Start = start;
Length = length;
Value = value;
}

public int Start { get; }

public int Length { get; }

public string Value { get; }
}

public static void Main()
{
DirectoryInfo solutionFolder = GetSolutionFolder();
DirectoryInfo docsFolder = new DirectoryInfo(Path.Combine(solutionFolder.FullName, "docs"));
Environment.CurrentDirectory = docsFolder.FullName;

ISet<string> fileNames = new HashSet<string>();
IDictionary<string, string> nameToFile = new Dictionary<string, string>();

IEnumerable<FileInfo> docFiles = docsFolder.GetFiles().ToList();
foreach (FileInfo docFile in docFiles)
Expand All @@ -47,7 +31,8 @@ public static void Main()
}

int dot = newName.LastIndexOf('.');
fileNames.Add(newName.Substring(0, dot));
string key = newName.Substring(dot) == ".md" ? newName.Substring(0, dot) : newName;
nameToFile.Add(key, newName);
}

docFiles = docsFolder.GetFiles();
Expand All @@ -73,10 +58,10 @@ public static void Main()
string innerValue = match.Value.Substring(1, match.Length - 2);
string link = innerValue;
string newName = TransformName(link);
if (fileNames.Contains(newName))
if (nameToFile.TryGetValue(newName, out var fileName))
{
Console.WriteLine(newName);
sb.Append(newName).Append(')');
Console.WriteLine(fileName);
sb.Append(fileName).Append(')');
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion 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)
[« Previous: The End of the Road](Chapter-21-The-End-of-the-Road.md)[Next: Bibliography and Recommended Reading »](Appendix-B-Bibliography-and-Recommended-Reading.md)
# Appendix A: TextEdit Command Index

|| Command || Description || Location || Accelerator ||
Expand Down
2 changes: 1 addition & 1 deletion 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)
[« Previous: TextEdit Command Index](Appendix-A-TextEdit-Command-Index.md)
# 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
2 changes: 1 addition & 1 deletion 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)
[« Previous: Introduction](Introduction.md)[Next: Designing for Users »](Chapter-2-Designing-for-Users.md)
# 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
6 changes: 3 additions & 3 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)
[« Previous: The Main Window](Chapter-9-The-Main-Window.md)[Next: Wait a Moment »](Chapter-11-Wait-a-Moment.md)
# 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 All @@ -14,7 +14,7 @@ Before we look at TextEdit-specific customization, let’s look at some of the t

Figure 12 shows the Appearance tab of the Display Control Panel applet. This dialog allows you to change colors, fonts and various metrics such as border widths.

![](Chapter 10 — Customization and Persistence_Figure12.bmp)
![](Chapter-10-Customization-and-Persistence-Figure12.bmp)

**Figure 12: Customizing the Appearance of Windows.** Check out GetSystemMetrics and GetSysColor before deciding on colors, fonts and metrics for your application.

Expand Down Expand Up @@ -50,7 +50,7 @@ Standard APIs to retrieve the various UI fonts would be appreciated. This could

The Windows Explorer, too, allows itself to be customized, and some of these customizations afflict – er, affect – TextEdit.

![](Chapter 10 — Customization and Persistence_Figure13.bmp)
![](Chapter-10-Customization-and-Persistence-Figure13.bmp)

**Figure 13: Customizing the Windows Explorer.** Some of these settings are useful to applications; unfortunately, there aren’t always documented ways to retrieve them.

Expand Down
2 changes: 1 addition & 1 deletion 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)
[« Previous: Customization and Persistence](Chapter-10-Customization-and-Persistence.md)[Next: File I/O »](Chapter-12-File-I-O.md)
# 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
2 changes: 1 addition & 1 deletion 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)
[« Previous: Wait a Moment](Chapter-11-Wait-a-Moment.md)[Next: About Dialogs »](Chapter-13-About-Dialogs.md)
# 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
10 changes: 5 additions & 5 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)
[« Previous: File I/O](Chapter-12-File-I-O.md)[Next: File Management »](Chapter-14-File-Management.md)
# 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.md)).

## What is a Dialog Box, Anyway?

Expand Down Expand Up @@ -82,7 +82,7 @@ The “About TextEdit” dialog box is about as simple as they come. The only co

The only possible interaction is to dismiss the dialog, which is why I call it simple in spite of the rather extensive initialization.

![](Chapter 13 — About Dialogs_Figure15.bmp)
![](Chapter-13-About-Dialogs-Figure15.bmp)

**Figure 15: The About Dialog.** Some STATIC widgets have been subjected to a WM{"_"}SETFONT message, while others have been subclassed.

Expand All @@ -98,7 +98,7 @@ More interesting is the boldfacing of individual words in the IDC{"_"}COMMENTS a

The Options dialog box looks like this:

![](Chapter 13 — About Dialogs_Figure16.bmp)
![](Chapter-13-About-Dialogs-Figure16.bmp)

**Figure 16: The Options Dialog.** The icons on the left are illustrative only; they do not reflect state in any way.

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.md).

[Sidebar: Default Buttons and Multi-line Edit](Sidebar_-Default-Buttons-and-Multi-line-Edit)
12 changes: 6 additions & 6 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)
[« Previous: File Management](Chapter-13-About-Dialogs.md)[Next: Search and Replace »](Chapter-15-Search-and-Replace.md)
# 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 All @@ -12,13 +12,13 @@ TextEdit also manages properties such as “Unicode.” TextEdit detects whether

The Properties dialog displays information about the currently loaded file: File name, location, file type, file size, time stamps, file attributes, Unicode and line separators. The layout of this dialog is similar to the Windows Explorer’s Properties dialog (see Figure 17).

![](Chapter 14 — File Management_Figure17.bmp)
![](Chapter-14-File-Management-Figure17.bmp)

**Figure 17: The Properties Dialog.** It is similar to the Exlorer’s corresponding dialog.

The dialog lets you change some of the attributes displayed in the dialog. You can change the file name on the fly, by typing a different name in the File Name field. To move the file to a different location, you must press the Move buttons to invoke a second dialog box (Figure 18); the Location field is read-only. This offloads everything to do with directories onto a common dialog designed for the purpose, and avoids issues of how to handle non-existent directories, invalid path names and so forth. A better solution would be one that allowed both approaches.

![](Chapter 14 — File Management_Figure18.bmp)
![](Chapter-14-File-Management-Figure18.bmp)

**Figure 18: Move or Rename File Dialog.** This is really a Save As dialog, with extra information on the top.

Expand All @@ -45,7 +45,7 @@ TextEdit’s Delete command deletes the current file. Since the unified file mod

The Delete command may or may not open the confirmation dialog shown in Figure 19. The ShowDeleteDialog registry variable defined in persistence.h controls this. The user, in turn, controls the registry variable. You can turn it off by unchecking the lower checkbox in Figure 19 (the one labeled “Show this dialog the next time you delete a file”). For obvious reasons, you can’t turn it back on using the same checkbox. To prevent the user from getting lost, the dialog explains how you can turn it back on. (Note how the functional part of the “confirm file delete” confirmation dialog stops at the horizontal line – what’s below is concerned with management of the dialog itself, and has nothing to do with deleting files.)

![](Chapter 14 — File Management_Figure19.bmp)
![](Chapter-14-File-Management-Figure19.bmp)

**Figure 19: The Delete File Dialog.** The upper icon is static and helps identify the dialog; the trash can icon is dynamic and changes according to the setting of its corresponding checkbox.

Expand Down Expand Up @@ -84,13 +84,13 @@ The icon serves as a visual reinforcement of the setting of the checkbox. In add

The Open File and Save File common dialogs are little Explorers in their own right. Figure 20 shows TextEdit’s Open File dialog in action. As you can see, it has four extra controls – one static label, one edit control used to show a preview of the selected file, one icon to show the type of the selected file and one checkbox that lets you open the file in a new window.

![](Chapter 14 — File Management_Figure20.bmp)
![](Chapter-14-File-Management-Figure20.bmp)

**Figure 20: The Open File Dialog.** The extra controls on the right come from the dialog template IDD{"_"}PREVIEW{"_"}CHILD.

You change the look of most common dialogs by specifying a resource template that replaces the default dialog. The Open and Save dialogs are exceptions; you specify, instead, the template of a child dialog that is added to the system-supplied dialog. The template must have the WS{"_"}CHILD style bit set, and it should include a static control with the ID stc32. This is a placeholder for the system-supplied dialog, and tells GetOpenFileName and GetSaveFileName how to place the child dialog in relation to predefined controls. Figure 21 shows the child dialog (IDD{"_"}PREVIEW{"_"}CHILD); its relationship to Figure 20 should be clear.

![](Chapter 14 — File Management_Figure21.bmp)
![](Chapter-14-File-Management-Figure21.bmp)

**Figure 21: The Open File Child Dialog.** The STATIC control labeled stc32 is a placeholder for the standard contents of the Open File dialog.

Expand Down
Loading

0 comments on commit 09b4cfc

Please sign in to comment.