Docs tweaks (#960)

Change header levels
Add Github workflow
Add reference to coding style
Minor tweaks
Fix links
Add border to images
Scale images
This commit is contained in:
Enrico Giordani 2019-12-17 17:02:45 +01:00 committed by GitHub
parent ad506d78ba
commit 5e2f681761
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 92 additions and 51 deletions

View file

@ -47,11 +47,11 @@ When terminating, the runner will:
- unload the DLL.
## Method definition
# Method definition
This section contains a more detailed description of each of the interface methods.
### powertoy_create_func
## powertoy_create_func
```cpp
typedef PowertoyModuleIface* (__cdecl *powertoy_create_func)()
@ -79,7 +79,7 @@ ExamplePowertoy::ExamplePowertoy() {
}
```
### get_name
## get_name
```cpp
virtual const wchar_t* get_name()
@ -94,7 +94,7 @@ Sample code from [`the example PowerToy`](/src/modules/example_powertoy/dllmain.
}
```
### get_events
## get_events
```cpp
virtual const wchar_t** get_events()
@ -117,7 +117,7 @@ Sample code from [`the example PowerToy`](/src/modules/example_powertoy/dllmain.
}
```
### get_config
## get_config
```
virtual bool get_config(wchar_t* buffer, int *buffer_size)
@ -167,7 +167,7 @@ Sample code from [`the example PowerToy`](/src/modules/example_powertoy/dllmain.
}
```
### set_config
## set_config
```cpp
virtual void set_config(const wchar_t* config)
@ -200,7 +200,7 @@ Sample code from [`the example PowerToy`](/src/modules/example_powertoy/dllmain.
}
```
### call_custom_action
## call_custom_action
```cpp
virtual void call_custom_action(const wchar_t* action)
@ -234,7 +234,7 @@ Sample code from [`the example PowerToy`](/src/modules/example_powertoy/dllmain.
}
```
### enable
## enable
```cpp
virtual void enable()
@ -250,7 +250,7 @@ Sample code from [`the example PowerToy`](/src/modules/example_powertoy/dllmain.
}
```
### disable
## disable
```cpp
virtual void disable()
@ -266,7 +266,7 @@ Sample code from [`the example PowerToy`](/src/modules/example_powertoy/dllmain.
}
```
### is_enabled
## is_enabled
```cpp
virtual bool is_enabled() = 0;
@ -281,7 +281,7 @@ Sample code from [`the example PowerToy`](/src/modules/example_powertoy/dllmain.
return m_enabled;
}
```
### signal_event
## signal_event
```cpp
virtual intptr_t signal_event(const wchar_t* name, intptr_t data) = 0;
@ -331,7 +331,7 @@ Module will be informed when action is taken on any item created on request of t
Runner invokes this API when action is taken on item created on request from the module.
Item name is passed as an argument, so that module can distinguish between different menu items.
### destroy
## destroy
```cpp
virtual void destroy()

View file

@ -1,17 +1,28 @@
# Code Organization
# Dev Documentation
## Rules
- **Follow the pattern of what you already see in the code**
- Try to package new ideas/components into libraries that have nicely defined interfaces
- Package new ideas into classes or refactor existing ideas into a class as you extend
- **Follow the pattern of what you already see in the code.**
- [Coding style](style.md).
- Try to package new ideas/components into libraries that have nicely defined interfaces.
- Package new ideas into classes or refactor existing ideas into a class as you extend.
- Whean adding new classes/methos/changing existing code: add new unit tests or update the existing tests.
## Code Overview
## Github Workflow
- Follow the PR template, in particular make sure there is open issue for the new PR.
- When the PR is approved, let the owner of the PR merge it.
- Use the `Squash and merge` option to merge a PR, if you don't want to squash it because there are logically different commits, use `Rebase and merge`.
- We don't close issues automatically when referenced in a PR, so after the OR is merged:
- mark the issue(s) fixed by the PR with the `resolved` label.
- don't close the issue if it's a bug in the current release since users tend to not search for closed issues, we will close the resolved issues when a new released is published.
## Repository Overview
General project organization:
#### The [`doc`](/doc) folder
Documentation for the project, including a [coding guide](/doc/coding) and [design docs](/doc/specs).
Documentation for the project.
#### The [`installer`](/installer) folder
Contains the source code of the PowerToys installer.
@ -24,7 +35,7 @@ Various tools used by PowerToys. Includes the Visual Studio 2019 project templat
# Implementation details
### [`Runner`](/doc/devdocs/runner.md)
### [`Runner`](runner.md)
The PowerToys Runner contains the project for the PowerToys.exe executable.
It's responsible for:
- Loading the individual PowerToys modules.
@ -34,14 +45,14 @@ It's responsible for:
![Image of the tray icon](/doc/images/runner/tray.png)
### [`Interface`](/doc/devdocs/modules/interface.md)
### [`Interface`](modules/interface.md)
Definition of the interface used by the [`runner`](/src/runner) to manage the PowerToys. All PowerToys must implement this interface.
### [`Common`](/doc/devdocs/common.md)
### [`Common`](common.md)
The common lib, as the name suggests, contains code shared by multiple PowerToys components and modules, e.g. [json parsing](/src/common/json.h) and [IPC primitives](/src/common/two_way_pipe_message_ipc.h).
### [`Settings`](/doc/devdocs/settings.md)
### [`Settings`](settings.md)
WebView project for editing the PowerToys settings.
The html portion of the project that is shown in the WebView is contained in [`settings-html`](/src/settings/settings-heml).
@ -49,21 +60,21 @@ Instructions on how build a new version and update this project are in the [Web
While developing, it's possible to connect the WebView to the development server running in localhost by setting the `_DEBUG_WITH_LOCALHOST` flag to `1` and following the instructions near it in `./main.cpp`.
### [`Settings-web`](/doc/devdocs/settings-web.md)
### [`Settings-web`](settings-web.md)
This project generates the web UI shown in the [PowerToys Settings](/src/editor).
It's a `ReactJS` project created using [UI Fabric](https://developer.microsoft.com/en-us/fabric#/).
## Current modules
### [`FancyZones`](/doc/devdocs/modules/fancyzones.md)
### [`FancyZones`](modules/fancyzones.md)
The FancyZones PowerToy that allows users to create custom zones on the screen, to which the windows will snap when moved.
### [`PowerRename`](/doc/devdocs/modules/powerrename.md)
### [`PowerRename`](modules/powerrename.md)
PowerRename is a Windows Shell Context Menu Extension for advanced bulk renaming using simple search and replace or more powerful regular expression matching.
### [`Shortcut Guide`](/doc/devdocs/modules/shortcut_guide.md)
### [`Shortcut Guide`](modules/shortcut_guide.md)
The Windows Shortcut Guide, displayed when the WinKey is held for some time.
### _obsolete_ [`example_powertoy`](/doc/devdocs/modules/example_powertoy.md)
### _obsolete_ [`example_powertoy`](modules/example_powertoy.md)
An example PowerToy, that demonstrates how to create new ones. Please note, that this is going to become a Visual Studio project template soon.
This PowerToy serves as a sample to show how to implement the [PowerToys interface](/src/modules/interface/) when creating a PowerToy. It also showcases the currently implemented settings.

View file

@ -78,10 +78,13 @@ void ExamplePowertoy::set_config(const wchar_t* config)
## Detailed reference
For a detailed reference of how the settings are implemented in the runner and in the settings editor, consult [this detailed guide](settings-reference.md).
## Available settings elements
# Available settings elements
## Bool toggle
<table><tr><td align="center">
<img src="../images/settings/bool_toggle.png" width="80%">
</td></tr></table>
### Bool toggle
![Bool Toggle](../images/settings/bool_toggle.png)
```c++
settings.add_bool_toogle(name, description, value)
```
@ -95,8 +98,11 @@ The toggle value is stored as bool:
std::optional<bool> bool_value = settings.get_bool_value(L"bool_name");
```
### Int Spinner
![Int Spinner](../images/settings/int_spinner.png)
## Int Spinner
<table><tr><td align="center">
<img src="../images/settings/int_spinner.png" width="80%">
</td></tr></table>
```c++
settings.add_int_spinner(name, description, value, min, max, step)
```
@ -112,8 +118,11 @@ The spinner value is stored as int:
std::optional<int> int_value = settings.get_int_value(L"int_spinner_name");
```
### String
![String](../images/settings/string.png)
## String
<table><tr><td align="center">
<img src="../images/settings/string.png" width="80%">
</td></tr></table>
```c++
settings.add_string(name, description, value)
```
@ -127,8 +136,11 @@ The input value is stored as `std::wstring`:
std::optional<std::wstring> string_value = settings.get_string_value(L"string_name");
```
### Multiline string
![Multiline](../images/settings/multiline.png)
## Multiline string
<table><tr><td align="center">
<img src="../images/settings/multiline.png" width="80%">
</td></tr></table>
```c++
settings.add_multiline_string(name, description, value)
```
@ -142,8 +154,11 @@ The input value is stored as string:
std::optional<std::wstring> value = settings.get_string_value(L"multiline_name");
```
### Color picker
![Color Picker](../images/settings/color_picker.png)
## Color picker
<table><tr><td align="center">
<img src="../images/settings/color_picker.png" width="80%">
</td></tr></table>
```c++
settings.add_color_picker(name, description, value)
```
@ -158,8 +173,11 @@ The color picker value is stored as `std::wstring` as `#RRGGBB`:
std::optional<std::wstring> value = settings.get_string_value(L"colorpicker_name");
```
### Hotkey
![Hotkey](../images/settings/hotkey.png)
## Hotkey
<table><tr><td align="center">
<img src="../images/settings/hotkey.png" width="80%">
</td></tr></table>
```c++
settings.add_hotkey(name, description, hotkey)
```
@ -188,8 +206,11 @@ if (value) {
}
```
### Choice group
![Choice group](../images/settings/choice_group.png)
## Choice group
<table><tr><td align="center">
<img src="../images/settings/choice_group.png" width="80%">
</td></tr></table>
```c++
add_choice_group(name, description, value, vector<pair<wstring, UINT>> keys_and_texts)
```
@ -205,10 +226,16 @@ The chosen button value is stored as a string with the key of the button selecte
std::optional<std::wstring> value = settings.get_string_value(L"choice_group_name");
```
### Dropdown
![Dropdown 1](../images/settings/dropdown_1.png)
## Dropdown
<table>
<tr><td align="center">
<img src="../images/settings/dropdown_1.png" width="80%">
</td></tr>
<tr><td align="center">
<img src="../images/settings/dropdown_2.png" width="80%">
</td></tr>
</table>
![Dropdown 2](../images/settings/dropdown_2.png)
```c++
add_dropdown(name, description, value, vector<pair<wstring, UINT>> keys_and_texts)
```
@ -223,8 +250,11 @@ The chosen value is stored as a string with the key of the option selected by th
```c++
std::optional<std::wstring> value = settings.get_string_value(L"dropdown_name");
```
### Custom action
![Custom action](../images/settings/custom_action.png)
## Custom action
<table><tr><td align="center">
<img src="../images/settings/custom_action.png" width="80%">
</td></tr></table>
```c++
add_custom_action(name, description, button_text, ext_description)
```
@ -245,13 +275,13 @@ void ExamplePowertoy::call_custom_action(const wchar_t* action) override
}
```
## File organization
# File organization
#### [main.cpp](/src/settings/main.cpp)
### [main.cpp](/src/settings/main.cpp)
Contains the main executable code, initializing and managing the Window containing the WebView and communication with the main PowerToys executable.
#### [StreamURIResolverFromFile.cpp](/src/settings/StreamURIResolverFromFile.cpp)
### [StreamURIResolverFromFile.cpp](/src/settings/StreamURIResolverFromFile.cpp)
Defines a class implementing `IUriToStreamResolver`. Allows the WebView to navigate to filesystem files in this Win32 project.
#### [settings-html/](/src/settings/settings-html/)
### [settings-html/](/src/settings/settings-html/)
Contains the assets file from building the [Web project for the Settings UI](/src/settings./settings-web). It will be loaded by the WebView.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4 KiB

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB