Skip to content

Commit

Permalink
Devdocs reorganisation (#913)
Browse files Browse the repository at this point in the history
* docs: split usage and dev docs

* # This is a combination of 2 commits.
# This is the 1st commit message:

docs: split usage and dev docs

# The commit message #2 will be skipped:

# fixup add docs

* docs: add runner documentation and move hooks documentation to devdocs

* docs: add stubs for modules technical description

* docs: add paragraph about event thread-safety

* docs: add 'Current modules' section header
  • Loading branch information
yuyoyuppe authored Dec 12, 2019
1 parent c31262b commit f385e46
Show file tree
Hide file tree
Showing 20 changed files with 432 additions and 348 deletions.
23 changes: 0 additions & 23 deletions doc/coding/organization.md

This file was deleted.

45 changes: 45 additions & 0 deletions doc/devdocs/common.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Classes and structures

#### class Animation: [header](/src/common/animation.h) [source](/src/common/animation.cpp)
Animation helper class with two easing-in animations: linear and exponential.

#### class AsyncMessageQueue: [header](/src/common/async_message_queue.h)
Header-only asynchronous message queue. Used by `TwoWayPipeMessageIPC`.

#### class TwoWayPipeMessageIPC: [header](/src/common/two_way_pipe_message_ipc.h)
Header-only asynchronous IPC messaging class. Used by the runner to communicate with the settings window.

#### class D2DSVG: [header](/src/common/d2d_svg.h) [source](/src/common/d2d_svg.cpp)
Class for loading, rendering and for some basic modifications of SVG graphics.

#### class D2DText: [header](/src/common/d2d_text.h) [source](/src/common/d2d_text.cpp)
Class for rendering text using DirectX.

#### class D2DWindow: [header](/src/common/d2d_window.h) [source](/src/common/d2d_window.cpp)
Base class for creating borderless windows, with DirectX enabled rendering pipeline.

#### class DPIAware: [header](/src/common/dpi_aware.h) [source](/src/common/dpi_aware.cpp)
Helper class for creating DPI-aware applications.

#### struct MonitorInfo: [header](/src/common/monitors.h) [source](/src/common/monitors.cpp)
Class for obtaining information about physical displays connected to the machine.

#### class Settings, class PowerToyValues, class CustomActionObject: [header](/src/common/settings_objects.h) [source](/src/common/settings_objects.cpp)
Classes used to define settings screens for the PowerToys modules.

#### class Tasklist: [header](/src/common/tasklist_positions.h) [source](/src/common/tasklist_positions.cpp)
Class that can detect the position of the windows buttons on the taskbar. It also detects which window will react to pressing `WinKey + number`.

#### struct WindowsColors: [header](/src/common/windows_colors.h) [source](/src/common/windows_colors.cpp)
Class for detecting the current Windows color scheme.

# Helpers

#### Common helpers: [header](/src/common/common.h) [source](/src/common/common.cpp)
Various helper functions.

#### Settings helpers: [header](/src/common/settings_helpers.h)
Helper methods for the settings.

#### Start visible helper: [header](/src/common/start_visible.h) [source](/src/common/start_visible.cpp)
Contains function to test if the Start menu is visible.
5 changes: 5 additions & 0 deletions doc/devdocs/modules/example_powertoy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#### [`dllmain.cpp`](/src/modules/example_powertoy/dllmain.cpp)
Contains DLL boilerplate code and implementation of the [PowerToys interface](/src/modules/interface/).

#### [`trace.cpp`](/src/modules/example_powertoy/trace.cpp)
Contains code for telemetry.
85 changes: 85 additions & 0 deletions doc/devdocs/modules/fancyzones.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
## FancyZones Lib

#### [`FancyZones.cpp`](/src/modules/fancyzones/lib/FancyZones.cpp)
TODO

#### [`Settings.cpp`](/src/modules/fancyzones/lib/Settings.cpp)
TODO

#### [`trace.cpp`](/src/modules/fancyzones/lib/trace.cpp)
TODO

#### [`Zone.cpp`](/src/modules/fancyzones/lib/Zone.cpp)
TODO

#### [`ZoneSet.cpp`](/src/modules/fancyzones/lib/ZoneSet.cpp)
TODO

#### [`ZoneWindow.cpp`](/src/modules/fancyzones/lib/ZoneWindow.cpp)
TODO

## FancyZones Editor

#### [`App.xaml.cs`](/src/modules/fancyzones/editor/App.xaml.cs)
TODO

#### [`Properties\AssemblyInfo.cs`](/src/modules/fancyzones/editor/Properties\AssemblyInfo.cs)
TODO

#### [`CanvasEditor.xaml.cs`](/src/modules/fancyzones/editor/CanvasEditor.xaml.cs)
TODO

#### [`CanvasEditorWindow.xaml.cs`](/src/modules/fancyzones/editor/CanvasEditorWindow.xaml.cs)
TODO

#### [`Models\CanvasLayoutModel.cs`](/src/modules/fancyzones/editor/Models\CanvasLayoutModel.cs)
TODO

#### [`CanvasZone.xaml.cs`](/src/modules/fancyzones/editor/CanvasZone.xaml.cs)
TODO

#### [`EditorOverlay.xaml.cs`](/src/modules/fancyzones/editor/EditorOverlay.xaml.cs)
TODO

#### [`EditorWindow.cs`](/src/modules/fancyzones/editor/EditorWindow.cs)
TODO

#### [`GridEditor.xaml.cs`](/src/modules/fancyzones/editor/GridEditor.xaml.cs)
TODO

#### [`GridEditorWindow.xaml.cs`](/src/modules/fancyzones/editor/GridEditorWindow.xaml.cs)
TODO

#### [`Models\GridLayoutModel.cs`](/src/modules/fancyzones/editor/Models\GridLayoutModel.cs)
TODO

#### [`GridResizer.xaml.cs`](/src/modules/fancyzones/editor/GridResizer.xaml.cs)
TODO

#### [`GridZone.xaml.cs`](/src/modules/fancyzones/editor/GridZone.xaml.cs)
TODO

#### [`Models\LayoutModel.cs`](/src/modules/fancyzones/editor/Models/LayoutModel.cs)
TODO

#### [`LayoutPreview.xaml.cs`](/src/modules/fancyzones/editor/LayoutPreview.xaml.cs)
TODO

#### [`MainWindow.xaml.cs`](/src/modules/fancyzones/editor/MainWindow.xaml.cs)
TODO

#### [`Properties\Resources.Designer.cs`](/src/modules/fancyzones/editor/Properties/Resources.Designer.cs)
TODO

#### [`RowColInfo.cs`](/src/modules/fancyzones/editor/RowColInfo.cs)
TODO

#### [`Models\Settings.cs`](/src/modules/fancyzones/editor/Models/Settings.cs)
TODO

#### [`Properties\Settings.Designer.cs`](/src/modules/fancyzones/editor/Properties/Settings.Designer.cs)
TODO

#### [`WindowLayout.xaml.cs`](/src/modules/fancyzones/editor/WindowLayout.xaml.cs)
TODO

Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
# PowerToys Interface

The PowerToys interface that each PowerToy must implement.
See [`the example PowerToy`](/src/modules/example_powertoy) for a PowerToys module example that uses this interface.

## Interface definition

This is the interface definition:
# Interface definition

```cpp
class PowertoyModuleIface {
Expand All @@ -27,7 +20,7 @@ public:
typedef PowertoyModuleIface* (__cdecl *powertoy_create_func)();
```
### Runtime logic
# Runtime logic
The PowerToys runner will, for each PowerToy DLL:
- load the DLL,
Expand All @@ -54,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)()
Expand Down Expand Up @@ -86,7 +79,7 @@ ExamplePowertoy::ExamplePowertoy() {
}
```

#### get_name
### get_name

```cpp
virtual const wchar_t* get_name()
Expand All @@ -101,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()
Expand All @@ -124,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)
Expand Down Expand Up @@ -174,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)
Expand Down Expand Up @@ -207,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)
Expand Down Expand Up @@ -241,7 +234,7 @@ Sample code from [`the example PowerToy`](/src/modules/example_powertoy/dllmain.
}
```

#### enable
### enable

```cpp
virtual void enable()
Expand All @@ -257,7 +250,7 @@ Sample code from [`the example PowerToy`](/src/modules/example_powertoy/dllmain.
}
```
#### disable
### disable
```cpp
virtual void disable()
Expand All @@ -273,7 +266,7 @@ Sample code from [`the example PowerToy`](/src/modules/example_powertoy/dllmain.
}
```
#### is_enabled
### is_enabled
```cpp
virtual bool is_enabled() = 0;
Expand All @@ -288,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;
Expand All @@ -299,6 +292,8 @@ The data argument and return value meaning are event-specific:
* ll_keyboard: see [`lowlevel_keyboard_event_data.h`](./lowlevel_keyboard_event_data.h).
* win_hook_event: see [`win_hook_event_data.h`](./win_hook_event_data.h)

Please note that some of the events are currently being signalled from a separate thread.

Sample code from [`the example PowerToy`](/src/modules/example_powertoy/dllmain.cpp):

```cpp
Expand All @@ -317,7 +312,7 @@ Sample code from [`the example PowerToy`](/src/modules/example_powertoy/dllmain.
}
```
### register_system_menu_helper
## register_system_menu_helper
```cpp
virtual void register_system_menu_helper(PowertoySystemMenuIface* helper) = 0;
Expand All @@ -327,7 +322,7 @@ Register helper class to handle all system menu items related actions. Creation,
and all other actions taken on system menu item will be handled by provided class.
Module will be informed when action is taken on any item created on request of the module.

### signal_system_menu_action
## signal_system_menu_action

```cpp
virtual void signal_system_menu_action(const wchar_t* name) = 0;
Expand All @@ -336,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()
Expand All @@ -351,7 +346,7 @@ Sample code from [`the example PowerToy`](/src/modules/example_powertoy/dllmain.
}
```
### Powertoys system menu helper interface
## Powertoys system menu helper interface
Interface for helper class responsible for handling all system menu related actions.
```cpp
Expand All @@ -367,7 +362,7 @@ public:
};
```

### ItemInfo
## ItemInfo

```cpp
struct ItemInfo {
Expand All @@ -380,33 +375,33 @@ public:
Structure containing all relevant information for system menu item: name (and hotkey if available), item
status at creation (enabled/disabled) and whether check box will appear next to item name when action is taken.
### SetConfiguration
## SetConfiguration
```cpp
virtual void SetConfiguration(PowertoyModuleIface* module, const std::vector<ItemInfo>& config) = 0;
```

Module should use this interface to inform system menu helper class which custom system menu items to create.

### ProcessSelectedItem
## ProcessSelectedItem

```cpp
virtual void ProcessSelectedItem(PowertoyModuleIface* module, HWND window, const wchar_t* itemName) = 0;
```
Process action taken on specific system menu item.
## Code organization
# Code organization
#### [`powertoy_module_interface.h`](./powertoy_module_interface.h)
### [`powertoy_module_interface.h`](/src/modules/example_powertoy/powertoy_module_interface.h)
Contains the PowerToys interface definition.
### [`powertoy_system_menu.h`](./powertoy_system_module.h)
### [`powertoy_system_menu.h`](/src/modules/example_powertoy/powertoy_system_module.h)
Contains the PowerToys system menu helper interface definition.
#### [`lowlevel_keyboard_event_data.h`](./lowlevel_keyboard_event_data.h)
### [`lowlevel_keyboard_event_data.h`](/src/modules/example_powertoy/lowlevel_keyboard_event_data.h)
Contains the `LowlevelKeyboardEvent` structure that's passed to `signal_event` for `ll_keyboard` events.
#### [`win_hook_event_data.h`](./win_hook_event_data.h)
### [`win_hook_event_data.h`](/src/modules/example_powertoy/win_hook_event_data.h)
Contains the `WinHookEvent` structure that's passed to `signal_event` for `win_hook_event` events.
Loading

0 comments on commit f385e46

Please sign in to comment.