├── docs ├── index.md ├── images │ ├── bio.png │ ├── mbid.png │ ├── total.png │ ├── allmusic.png │ ├── samples.png │ ├── similar.png │ ├── single.png │ ├── tagger.png │ ├── thumbs.png │ ├── album_art.png │ ├── jsplaylist.png │ ├── properties.png │ ├── lastfm_demo.gif │ ├── musicbrainz.png │ ├── lastfm_context.png │ ├── smooth_browser.png │ ├── smooth_playlist.png │ ├── editor_properties.png │ ├── lastfm_preferences.png │ ├── configuration_window.png │ ├── musicbrainz_context.png │ └── listenbrainz_preferences.png ├── _config.yml ├── foo_jscript_panel │ ├── Editor-Properties.md │ ├── WINE.md │ ├── Gallery.md │ ├── Configuration-Window.md │ ├── Samples.md │ └── Overview.md ├── assets │ └── css │ │ └── style.scss ├── _layouts │ └── default.html └── foo_jscript_panel.md ├── src ├── stdafx.cpp ├── script_interface │ ├── Console.h │ ├── Profiler.h │ ├── Gdi.h │ ├── MainMenuManager.h │ ├── UiSelectionHolder.h │ ├── TitleFormat.h │ ├── GdiRawBitmap.h │ ├── PlayingItemLocation.h │ ├── GdiFont.h │ ├── ContextMenuManager.h │ ├── MeasureStringInfo.h │ ├── PlaybackQueueItem.h │ ├── Profiler.cpp │ ├── ThemeManager.h │ ├── DropSourceAction.h │ ├── script_interface.h │ ├── MenuObj.h │ ├── UiSelectionHolder.cpp │ ├── FileInfo.h │ ├── PlayingItemLocation.cpp │ ├── Console.cpp │ ├── DropSourceAction.cpp │ ├── GdiBitmap.h │ ├── MeasureStringInfo.cpp │ ├── MetadbHandle.h │ ├── Tooltip.h │ ├── PlaybackQueueItem.cpp │ ├── GdiFont.cpp │ ├── ContextMenuManager.cpp │ ├── ThemeManager.cpp │ ├── MainMenuManager.cpp │ ├── GdiRawBitmap.cpp │ ├── TitleFormat.cpp │ ├── Gdi.cpp │ ├── MetadbHandleList.h │ └── MenuObj.cpp ├── stats.h ├── ui │ ├── ui_goto.h │ ├── ui_goto.cpp │ ├── ui_input_box.h │ ├── ui_input_box.cpp │ ├── config.h │ ├── ui_property.h │ ├── ui_conf.h │ └── ui_find_replace.h ├── resource │ ├── cfgBright.cfg │ ├── cfgDark.cfg │ └── cfgRubyBlue.cfg ├── panel_properties.h ├── drop_source_impl.h ├── panel_manager.h ├── host_drop_target.h ├── cpp.hint ├── foo_jscript_panel.cpp ├── callback_data.h ├── stdafx.h ├── thread_pool.h ├── foo_jscript_panel.h ├── script_info.h ├── mainmenu.cpp ├── panel_window.h └── drop_target_impl.h ├── scintilla ├── win32 │ ├── Scintilla.def │ ├── HanjaDic.h │ ├── ScintillaWin.h │ ├── PlatWin.h │ ├── SciTE.properties │ ├── ScintRes.rc │ └── DepGen.py ├── src │ ├── SciTE.properties │ ├── DBCS.h │ ├── Catalogue.h │ ├── Position.h │ ├── IntegerRectangle.h │ ├── FontQuality.h │ ├── CharClassify.h │ ├── ElapsedPeriod.h │ ├── CaseFolder.h │ ├── DBCS.cxx │ ├── UniqueString.cxx │ ├── UniqueString.h │ ├── KeyMap.h │ ├── MarginView.h │ ├── CaseConvert.h │ ├── ContractionState.h │ ├── CharClassify.cxx │ ├── Indicator.h │ ├── LineMarker.h │ ├── CaseFolder.cxx │ ├── RESearch.h │ ├── EditModel.h │ ├── ExternalLexer.h │ └── Decoration.h ├── include │ ├── ILoader.h │ └── Sci_Position.h └── lexlib │ ├── PropSetSimple.h │ ├── LexerSimple.h │ ├── Accessor.h │ ├── StringCopy.h │ ├── WordList.h │ ├── LexerNoExceptions.h │ ├── CharacterSet.cxx │ ├── CharacterCategory.h │ ├── LexerSimple.cxx │ ├── StyleContext.cxx │ └── LexerNoExceptions.cxx ├── .editorconfig ├── component ├── samples │ ├── basic │ │ ├── js │ │ │ └── includeme.js │ │ ├── images │ │ │ ├── cog.png │ │ │ ├── mask.png │ │ │ └── post.jpg │ │ ├── Preprocessor.txt │ │ ├── Watch Metadb Change.txt │ │ ├── ColourPicker.txt │ │ ├── SimpleFollowCursor.txt │ │ ├── GetAlbumArtV2.txt │ │ ├── StackBlur (image).txt │ │ ├── StackBlur (text).txt │ │ ├── Timer.txt │ │ ├── Menu Sample.txt │ │ ├── Volbar with GdiDrawText.txt │ │ ├── GetAlbumArtAsync.txt │ │ └── ApplyMask.txt │ ├── readme.txt │ ├── js-smooth │ │ ├── images │ │ │ ├── load.png │ │ │ ├── default.png │ │ │ └── genres │ │ │ │ ├── 60's.jpg │ │ │ │ ├── 70's.jpg │ │ │ │ ├── 80's.jpg │ │ │ │ └── 90's.jpg │ │ ├── JS Smooth Playlist Manager.txt │ │ ├── JS Smooth Playlist.txt │ │ └── JS Smooth Browser.txt │ ├── complete │ │ ├── images │ │ │ ├── cd │ │ │ │ ├── case.png │ │ │ │ ├── gloss.png │ │ │ │ ├── semi.png │ │ │ │ └── shadow.png │ │ │ ├── buttons │ │ │ │ ├── help.png │ │ │ │ ├── next.png │ │ │ │ ├── pause.png │ │ │ │ ├── play.png │ │ │ │ ├── stop.png │ │ │ │ ├── previous.png │ │ │ │ ├── search.png │ │ │ │ └── preferences.png │ │ │ └── misc │ │ │ │ ├── blank600.png │ │ │ │ ├── foobar2000.png │ │ │ │ ├── listenbrainz_active.png │ │ │ │ └── listenbrainz_inactive.png │ │ ├── vbs │ │ │ └── download.vbs │ │ ├── volume.txt │ │ ├── album art.txt │ │ ├── thumbs.txt │ │ ├── menu button.txt │ │ ├── seekbar.txt │ │ ├── autoplaylists.txt │ │ ├── queue viewer.txt │ │ ├── text reader.txt │ │ ├── allmusic review.txt │ │ ├── rating.txt │ │ ├── last.fm bio.txt │ │ ├── musicbrainz.txt │ │ ├── properties.txt │ │ ├── last.fm similar artists + user charts + recent tracks.txt │ │ ├── playback buttons.txt │ │ ├── js │ │ │ └── volume.js │ │ └── listenbrainz.txt │ └── jsplaylist-mod │ │ └── images │ │ ├── load.png │ │ ├── logo.png │ │ ├── default.jpg │ │ ├── nocover.png │ │ ├── stream.png │ │ └── noartist.png ├── docs │ ├── Notes & Hints.txt │ └── Preprocessors.txt └── licenses │ ├── PFC.txt │ ├── Scintilla + SciTE.txt │ ├── JScript Panel.txt │ ├── StackBlur.txt │ ├── JSON for Modern C++.txt │ └── foobar2000 SDK.txt ├── .gitmodules ├── README.md ├── .gitattributes ├── azure-pipelines.yml └── LICENSE.md /docs/index.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | -------------------------------------------------------------------------------- /scintilla/win32/Scintilla.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | Scintilla_DirectFunction -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | insert_final_newline = true 5 | charset = utf-8 6 | -------------------------------------------------------------------------------- /docs/images/bio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/docs/images/bio.png -------------------------------------------------------------------------------- /component/samples/basic/js/includeme.js: -------------------------------------------------------------------------------- 1 | function print_to_console(msg) { 2 | console.log(msg); 3 | } 4 | -------------------------------------------------------------------------------- /docs/images/mbid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/docs/images/mbid.png -------------------------------------------------------------------------------- /docs/images/total.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/docs/images/total.png -------------------------------------------------------------------------------- /docs/images/allmusic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/docs/images/allmusic.png -------------------------------------------------------------------------------- /docs/images/samples.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/docs/images/samples.png -------------------------------------------------------------------------------- /docs/images/similar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/docs/images/similar.png -------------------------------------------------------------------------------- /docs/images/single.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/docs/images/single.png -------------------------------------------------------------------------------- /docs/images/tagger.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/docs/images/tagger.png -------------------------------------------------------------------------------- /docs/images/thumbs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/docs/images/thumbs.png -------------------------------------------------------------------------------- /component/samples/readme.txt: -------------------------------------------------------------------------------- 1 | See https://kbuffington.github.io/foo_jscript_panel/foo_jscript_panel/Samples.html 2 | -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-hacker 2 | google_analytics: UA-30849475-4 3 | baseurl: /foo_jscript_panel 4 | -------------------------------------------------------------------------------- /docs/images/album_art.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/docs/images/album_art.png -------------------------------------------------------------------------------- /docs/images/jsplaylist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/docs/images/jsplaylist.png -------------------------------------------------------------------------------- /docs/images/properties.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/docs/images/properties.png -------------------------------------------------------------------------------- /docs/images/lastfm_demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/docs/images/lastfm_demo.gif -------------------------------------------------------------------------------- /docs/images/musicbrainz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/docs/images/musicbrainz.png -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "foobar2000-SDK"] 2 | path = foobar2000-SDK 3 | url = https://github.com/kbuffington/foobar2000-SDK 4 | -------------------------------------------------------------------------------- /docs/images/lastfm_context.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/docs/images/lastfm_context.png -------------------------------------------------------------------------------- /docs/images/smooth_browser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/docs/images/smooth_browser.png -------------------------------------------------------------------------------- /docs/images/smooth_playlist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/docs/images/smooth_playlist.png -------------------------------------------------------------------------------- /docs/images/editor_properties.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/docs/images/editor_properties.png -------------------------------------------------------------------------------- /docs/images/lastfm_preferences.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/docs/images/lastfm_preferences.png -------------------------------------------------------------------------------- /docs/images/configuration_window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/docs/images/configuration_window.png -------------------------------------------------------------------------------- /docs/images/musicbrainz_context.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/docs/images/musicbrainz_context.png -------------------------------------------------------------------------------- /component/samples/basic/images/cog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/component/samples/basic/images/cog.png -------------------------------------------------------------------------------- /component/samples/basic/images/mask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/component/samples/basic/images/mask.png -------------------------------------------------------------------------------- /component/samples/basic/images/post.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/component/samples/basic/images/post.jpg -------------------------------------------------------------------------------- /docs/images/listenbrainz_preferences.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/docs/images/listenbrainz_preferences.png -------------------------------------------------------------------------------- /component/samples/js-smooth/images/load.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/component/samples/js-smooth/images/load.png -------------------------------------------------------------------------------- /component/samples/complete/images/cd/case.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/component/samples/complete/images/cd/case.png -------------------------------------------------------------------------------- /component/samples/complete/images/cd/gloss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/component/samples/complete/images/cd/gloss.png -------------------------------------------------------------------------------- /component/samples/complete/images/cd/semi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/component/samples/complete/images/cd/semi.png -------------------------------------------------------------------------------- /component/samples/js-smooth/images/default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/component/samples/js-smooth/images/default.png -------------------------------------------------------------------------------- /component/samples/complete/images/cd/shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/component/samples/complete/images/cd/shadow.png -------------------------------------------------------------------------------- /component/samples/jsplaylist-mod/images/load.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/component/samples/jsplaylist-mod/images/load.png -------------------------------------------------------------------------------- /component/samples/jsplaylist-mod/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/component/samples/jsplaylist-mod/images/logo.png -------------------------------------------------------------------------------- /component/samples/complete/images/buttons/help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/component/samples/complete/images/buttons/help.png -------------------------------------------------------------------------------- /component/samples/complete/images/buttons/next.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/component/samples/complete/images/buttons/next.png -------------------------------------------------------------------------------- /component/samples/complete/images/buttons/pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/component/samples/complete/images/buttons/pause.png -------------------------------------------------------------------------------- /component/samples/complete/images/buttons/play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/component/samples/complete/images/buttons/play.png -------------------------------------------------------------------------------- /component/samples/complete/images/buttons/stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/component/samples/complete/images/buttons/stop.png -------------------------------------------------------------------------------- /component/samples/complete/images/misc/blank600.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/component/samples/complete/images/misc/blank600.png -------------------------------------------------------------------------------- /component/samples/js-smooth/images/genres/60's.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/component/samples/js-smooth/images/genres/60's.jpg -------------------------------------------------------------------------------- /component/samples/js-smooth/images/genres/70's.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/component/samples/js-smooth/images/genres/70's.jpg -------------------------------------------------------------------------------- /component/samples/js-smooth/images/genres/80's.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/component/samples/js-smooth/images/genres/80's.jpg -------------------------------------------------------------------------------- /component/samples/js-smooth/images/genres/90's.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/component/samples/js-smooth/images/genres/90's.jpg -------------------------------------------------------------------------------- /component/samples/jsplaylist-mod/images/default.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/component/samples/jsplaylist-mod/images/default.jpg -------------------------------------------------------------------------------- /component/samples/jsplaylist-mod/images/nocover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/component/samples/jsplaylist-mod/images/nocover.png -------------------------------------------------------------------------------- /component/samples/jsplaylist-mod/images/stream.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/component/samples/jsplaylist-mod/images/stream.png -------------------------------------------------------------------------------- /component/samples/complete/images/buttons/previous.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/component/samples/complete/images/buttons/previous.png -------------------------------------------------------------------------------- /component/samples/complete/images/buttons/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/component/samples/complete/images/buttons/search.png -------------------------------------------------------------------------------- /component/samples/complete/images/misc/foobar2000.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/component/samples/complete/images/misc/foobar2000.png -------------------------------------------------------------------------------- /component/samples/jsplaylist-mod/images/noartist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/component/samples/jsplaylist-mod/images/noartist.png -------------------------------------------------------------------------------- /component/samples/complete/images/buttons/preferences.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/component/samples/complete/images/buttons/preferences.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## foo_jscript_panel 2 | 3 | [![Licenses](https://img.shields.io/badge/license-MIT-brightgreen)](component/licenses) 4 | 5 | https://kbuffington.github.io/foo_jscript_panel/ 6 | -------------------------------------------------------------------------------- /component/samples/complete/images/misc/listenbrainz_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/component/samples/complete/images/misc/listenbrainz_active.png -------------------------------------------------------------------------------- /component/samples/complete/images/misc/listenbrainz_inactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kbuffington/foo_jscript_panel/HEAD/component/samples/complete/images/misc/listenbrainz_inactive.png -------------------------------------------------------------------------------- /src/script_interface/Console.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "script_interface.h" 3 | 4 | class Console : public IDispatchImpl3 5 | { 6 | protected: 7 | Console(); 8 | ~Console(); 9 | 10 | public: 11 | STDMETHODIMP Log(SAFEARRAY* p) override; 12 | }; 13 | -------------------------------------------------------------------------------- /scintilla/src/SciTE.properties: -------------------------------------------------------------------------------- 1 | # SciTE.properties is the per directory local options file and can be used to override 2 | # settings made in SciTEGlobal.properties 3 | command.build.directory.*.cxx=..\win32 4 | command.build.directory.*.h=..\win32 5 | command.build.*.cxx=nmake -f scintilla.mak QUIET=1 6 | command.build.*.h=nmake -f scintilla.mak QUIET=1 7 | -------------------------------------------------------------------------------- /component/samples/basic/Preprocessor.txt: -------------------------------------------------------------------------------- 1 | // ==PREPROCESSOR== 2 | // @name "Preprocessor" 3 | // @author "T.P Wang" 4 | // @import "%fb2k_component_path%samples\basic\js\includeme.js" 5 | // ==/PREPROCESSOR== 6 | 7 | //check samples\basic\js\includeme.js for print_to_console function 8 | print_to_console('Hello world!'); 9 | 10 | fb.ShowConsole(); 11 | -------------------------------------------------------------------------------- /component/samples/basic/Watch Metadb Change.txt: -------------------------------------------------------------------------------- 1 | // ==PREPROCESSOR== 2 | // @name "Watch Metadb Change" 3 | // @author "T.P Wang" 4 | // ==/PREPROCESSOR== 5 | 6 | // Callback 7 | function on_metadb_changed(handle_list) { 8 | var count = handle_list.Count; 9 | // show how many files have been changed 10 | fb.ShowPopupMessage(count + (count == 1 ? ' file has' : ' files have') + ' been changed.'); 11 | } 12 | -------------------------------------------------------------------------------- /docs/foo_jscript_panel/Editor-Properties.md: -------------------------------------------------------------------------------- 1 | ## Editor Properties 2 | 3 | From `File>Preferences>Tools>JScript Panel` you can customise the fonts/colours used in the [Configuration Window](Configuration-Window.md). 4 | 5 | ![Configuration Window](../images/editor_properties.png) 6 | 7 | As of `v2.2.0`, there is a `Presets` button which provides quick access to the themes that were previously bundled inside the component folder. 8 | -------------------------------------------------------------------------------- /src/script_interface/Profiler.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "script_interface.h" 3 | 4 | class Profiler : public IDispatchImpl3 5 | { 6 | protected: 7 | Profiler(const char* p_name); 8 | ~Profiler(); 9 | 10 | pfc::hires_timer m_timer; 11 | pfc::string_simple m_name; 12 | 13 | public: 14 | STDMETHODIMP Print() override; 15 | STDMETHODIMP Reset() override; 16 | STDMETHODIMP get_Time(int* p) override; 17 | }; 18 | -------------------------------------------------------------------------------- /src/script_interface/Gdi.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "script_interface.h" 3 | 4 | class Gdi : public IDispatchImpl3 5 | { 6 | protected: 7 | Gdi(); 8 | ~Gdi(); 9 | 10 | public: 11 | STDMETHODIMP CreateImage(int w, int h, IGdiBitmap** pp) override; 12 | STDMETHODIMP Font(BSTR name, float pxSize, int style, IGdiFont** pp) override; 13 | STDMETHODIMP Image(BSTR path, IGdiBitmap** pp) override; 14 | STDMETHODIMP LoadImageAsync(UINT window_id, BSTR path, UINT* p) override; 15 | }; 16 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | 19 | component/* linguist-detectable=false 20 | -------------------------------------------------------------------------------- /src/script_interface/MainMenuManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "script_interface.h" 3 | 4 | class MainMenuManager : public IDisposableImpl4 5 | { 6 | protected: 7 | MainMenuManager(); 8 | ~MainMenuManager(); 9 | 10 | void FinalRelease() override; 11 | 12 | mainmenu_manager::ptr m_mm; 13 | 14 | public: 15 | STDMETHODIMP BuildMenu(IMenuObj* p, UINT base_id) override; 16 | STDMETHODIMP ExecuteByID(UINT id, VARIANT_BOOL* p) override; 17 | STDMETHODIMP Init(BSTR root_name) override; 18 | }; 19 | -------------------------------------------------------------------------------- /azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | jobs: 2 | - job: build 3 | displayName: Build 4 | strategy: 5 | matrix: 6 | Debug: 7 | configuration: Debug 8 | Release: 9 | configuration: Release 10 | pool: 11 | vmImage: windows-2019 12 | steps: 13 | - checkout: self 14 | submodules: recursive 15 | - task: VSBuild@1 16 | displayName: Build 17 | inputs: 18 | solution: src/foo_jscript_panel.sln 19 | platform: Win32 20 | configuration: $(configuration) 21 | msbuildArgs: /m 22 | -------------------------------------------------------------------------------- /scintilla/win32/HanjaDic.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file HanjaDic.h 3 | ** Korean Hanja Dictionary 4 | ** Convert between Korean Hanja and Hangul by COM interface. 5 | **/ 6 | // Copyright 2015 by Neil Hodgson 7 | // The License.txt file describes the conditions under which this software may be distributed. 8 | 9 | #ifndef HANJADIC_H 10 | #define HANJADIC_H 11 | 12 | namespace Scintilla { 13 | 14 | namespace HanjaDict { 15 | 16 | int GetHangulOfHanja(wchar_t *inout); 17 | 18 | } 19 | 20 | } 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /src/script_interface/UiSelectionHolder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "script_interface.h" 3 | 4 | class UiSelectionHolder : public IDisposableImpl4 5 | { 6 | protected: 7 | UiSelectionHolder(const ui_selection_holder::ptr& holder); 8 | ~UiSelectionHolder(); 9 | 10 | void FinalRelease() override; 11 | 12 | ui_selection_holder::ptr m_holder; 13 | 14 | public: 15 | STDMETHODIMP SetPlaylistSelectionTracking() override; 16 | STDMETHODIMP SetPlaylistTracking() override; 17 | STDMETHODIMP SetSelection(IMetadbHandleList* handles) override; 18 | }; 19 | -------------------------------------------------------------------------------- /scintilla/win32/ScintillaWin.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file ScintillaWin.h 3 | ** Define functions from ScintillaWin.cxx that can be called from ScintillaDLL.cxx. 4 | **/ 5 | // Copyright 1998-2018 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | class ScintillaWin; 9 | 10 | namespace Scintilla { 11 | 12 | int ResourcesRelease(bool fromDllMain); 13 | sptr_t DirectFunction(ScintillaWin *sci, UINT iMessage, uptr_t wParam, sptr_t lParam); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/script_interface/TitleFormat.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "script_interface.h" 3 | 4 | class TitleFormat : public IDisposableImpl4 5 | { 6 | protected: 7 | TitleFormat(BSTR pattern); 8 | ~TitleFormat(); 9 | 10 | void FinalRelease() override; 11 | 12 | titleformat_object::ptr m_obj; 13 | 14 | public: 15 | STDMETHODIMP get__ptr(void** pp) override; 16 | STDMETHODIMP Eval(BSTR* p) override; 17 | STDMETHODIMP EvalWithMetadb(IMetadbHandle* handle, BSTR* p) override; 18 | STDMETHODIMP EvalWithMetadbs(IMetadbHandleList* handles, VARIANT* p) override; 19 | }; 20 | -------------------------------------------------------------------------------- /src/script_interface/GdiRawBitmap.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "script_interface.h" 3 | 4 | class GdiRawBitmap : public IDisposableImpl4 5 | { 6 | protected: 7 | GdiRawBitmap(Gdiplus::Bitmap* p_bmp); 8 | ~GdiRawBitmap(); 9 | 10 | HBITMAP CreateHBITMAP(Gdiplus::Bitmap* bitmap_ptr); 11 | void FinalRelease() override; 12 | 13 | HBITMAP m_hbmp, m_hbmpold; 14 | HDC m_hdc; 15 | size_t m_height, m_width; 16 | 17 | public: 18 | STDMETHODIMP get__Handle(HDC* p) override; 19 | STDMETHODIMP get_Height(UINT* p) override; 20 | STDMETHODIMP get_Width(UINT* p) override; 21 | }; 22 | -------------------------------------------------------------------------------- /src/script_interface/PlayingItemLocation.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "script_interface.h" 3 | 4 | class PlayingItemLocation : public IDispatchImpl3 5 | { 6 | protected: 7 | PlayingItemLocation(bool isValid, size_t playlistIndex, size_t playlistItemIndex); 8 | 9 | bool m_isValid = false; 10 | size_t m_playlistIndex = SIZE_MAX; 11 | size_t m_playlistItemIndex = SIZE_MAX; 12 | 13 | public: 14 | STDMETHODIMP get_IsValid(VARIANT_BOOL* p) override; 15 | STDMETHODIMP get_PlaylistIndex(int* p) override; 16 | STDMETHODIMP get_PlaylistItemIndex(int* p) override; 17 | }; 18 | -------------------------------------------------------------------------------- /src/stats.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace stats 4 | { 5 | struct fields 6 | { 7 | size_t playcount = 0; 8 | size_t loved = 0; 9 | pfc::string8_fast first_played; 10 | pfc::string8_fast last_played; 11 | size_t rating = 0; 12 | }; 13 | 14 | using hash_set = std::set; 15 | 16 | bool hashHandle(const metadb_handle_ptr& handle, metadb_index_hash& hash); 17 | fields get(metadb_index_hash hash); 18 | metadb_index_manager::ptr theAPI(); 19 | void get_hashes(metadb_handle_list_cref handles, hash_set& hashes); 20 | void set(metadb_index_hash hash, fields f); 21 | } 22 | -------------------------------------------------------------------------------- /src/ui/ui_goto.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "editor_ctrl.h" 3 | 4 | class CDialogGoto : public CDialogImpl 5 | { 6 | public: 7 | CDialogGoto(CWindow parent, const pfc::string8_fast& text); 8 | 9 | BEGIN_MSG_MAP_EX(CDialogGoto) 10 | MSG_WM_INITDIALOG(OnInitDialog) 11 | COMMAND_RANGE_HANDLER_EX(IDOK, IDCANCEL, OnCloseCmd) 12 | END_MSG_MAP() 13 | 14 | enum { IDD = IDD_DIALOG_GOTO }; 15 | 16 | BOOL OnInitDialog(CWindow, LPARAM); 17 | void OnCloseCmd(UINT, int nID, CWindow); 18 | 19 | private: 20 | CEdit m_edit; 21 | CWindow m_parent = nullptr; 22 | pfc::string8_fast m_text; 23 | }; 24 | -------------------------------------------------------------------------------- /src/script_interface/GdiFont.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "script_interface.h" 3 | 4 | class GdiFont : public GdiObj 5 | { 6 | protected: 7 | GdiFont(Gdiplus::Font* p, HFONT hFont, bool managed = true); 8 | ~GdiFont(); 9 | 10 | void FinalRelease() override; 11 | 12 | HFONT m_hFont = nullptr; 13 | bool m_managed = true; 14 | 15 | public: 16 | STDMETHODIMP get__HFont(UINT* p) override; 17 | STDMETHODIMP get_Height(UINT* p) override; 18 | STDMETHODIMP get_Name(BSTR* p) override; 19 | STDMETHODIMP get_Size(float* p) override; 20 | STDMETHODIMP get_Style(int* p) override; 21 | }; 22 | -------------------------------------------------------------------------------- /src/script_interface/ContextMenuManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "script_interface.h" 3 | 4 | class ContextMenuManager : public IDisposableImpl4 5 | { 6 | protected: 7 | ContextMenuManager(); 8 | ~ContextMenuManager(); 9 | 10 | void FinalRelease() override; 11 | 12 | contextmenu_manager::ptr m_cm; 13 | 14 | public: 15 | STDMETHODIMP BuildMenu(IMenuObj* p, int base_id) override; 16 | STDMETHODIMP ExecuteByID(UINT id, VARIANT_BOOL* p) override; 17 | STDMETHODIMP InitContext(IMetadbHandleList* handles) override; 18 | STDMETHODIMP InitContextPlaylist() override; 19 | STDMETHODIMP InitNowPlaying() override; 20 | }; 21 | -------------------------------------------------------------------------------- /src/script_interface/MeasureStringInfo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "script_interface.h" 3 | 4 | class MeasureStringInfo : public IDispatchImpl3 5 | { 6 | protected: 7 | MeasureStringInfo(float x, float y, float w, float h, int l, int c); 8 | ~MeasureStringInfo(); 9 | 10 | float m_x, m_y, m_w, m_h; 11 | int m_l, m_c; 12 | 13 | public: 14 | STDMETHODIMP get_chars(int* p) override; 15 | STDMETHODIMP get_height(float* p) override; 16 | STDMETHODIMP get_lines(int* p) override; 17 | STDMETHODIMP get_width(float* p) override; 18 | STDMETHODIMP get_x(float* p) override; 19 | STDMETHODIMP get_y(float* p) override; 20 | }; 21 | -------------------------------------------------------------------------------- /src/script_interface/PlaybackQueueItem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "script_interface.h" 3 | 4 | class PlaybackQueueItem : public IDisposableImpl4 5 | { 6 | protected: 7 | PlaybackQueueItem(); 8 | PlaybackQueueItem(const t_playback_queue_item& playbackQueueItem); 9 | ~PlaybackQueueItem(); 10 | 11 | void FinalRelease() override; 12 | 13 | t_playback_queue_item m_playback_queue_item; 14 | 15 | public: 16 | STDMETHODIMP get__ptr(void** pp) override; 17 | STDMETHODIMP get_Handle(IMetadbHandle** pp) override; 18 | STDMETHODIMP get_PlaylistIndex(int* p) override; 19 | STDMETHODIMP get_PlaylistItemIndex(int* p) override; 20 | }; 21 | -------------------------------------------------------------------------------- /src/ui/ui_goto.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "ui_goto.h" 3 | 4 | CDialogGoto::CDialogGoto(CWindow parent, const pfc::string8_fast& text) : m_parent(parent), m_text(text) {} 5 | 6 | BOOL CDialogGoto::OnInitDialog(CWindow, LPARAM) 7 | { 8 | m_edit = GetDlgItem(IDC_EDIT_LINENUMBER); 9 | uSetWindowText(m_edit, m_text); 10 | return TRUE; 11 | } 12 | 13 | void CDialogGoto::OnCloseCmd(UINT, int nID, CWindow) 14 | { 15 | if (nID == IDOK) 16 | { 17 | uGetWindowText(m_edit, m_text); 18 | const size_t i = pfc::atoui_ex(m_text.get_ptr(), m_text.get_length()) - 1; 19 | SendMessage(m_parent, SCI_GOTOLINE, i, 0); 20 | } 21 | EndDialog(nID); 22 | } 23 | -------------------------------------------------------------------------------- /src/ui/ui_input_box.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CInputBox : public CDialogImpl 4 | { 5 | public: 6 | CInputBox(const char* p_prompt, const char* p_caption, const char* p_value); 7 | 8 | BEGIN_MSG_MAP_EX(CInputBox) 9 | MSG_WM_INITDIALOG(OnInitDialog) 10 | COMMAND_RANGE_HANDLER_EX(IDOK, IDCANCEL, OnCloseCmd) 11 | END_MSG_MAP() 12 | 13 | enum { IDD = IDD_DIALOG_INPUT }; 14 | 15 | BOOL OnInitDialog(CWindow, LPARAM); 16 | void OnCloseCmd(UINT, int nID, CWindow); 17 | 18 | pfc::string8_fast m_value; 19 | 20 | private: 21 | CEdit m_edit; 22 | CWindow m_label; 23 | pfc::string8_fast m_prompt; 24 | pfc::string8_fast m_caption; 25 | }; 26 | -------------------------------------------------------------------------------- /src/resource/cfgBright.cfg: -------------------------------------------------------------------------------- 1 | # Generated by JScript Panel 2 | style.default=font:Courier New,size:10,fore:#000000,back:#ffffff 3 | style.comment=italics,fore:#666666 4 | style.keyword=fore:#000085 5 | style.indentifier=fore:#006600 6 | style.string=fore:#996633 7 | style.number=fore:#8b0000 8 | style.operator=fore:#781f87 9 | style.linenumber=font:Courier New,size:8,fore:#555555 10 | style.bracelight=bold,fore:#ff0000,back:#ffff99 11 | style.bracebad=bold,fore:#ff6666,back:#ffff66 12 | style.selection.fore= 13 | style.selection.back= 14 | style.selection.alpha=256 15 | style.caret.fore= 16 | style.caret.width=1 17 | style.caret.line.back= 18 | style.caret.line.back.alpha=256 19 | -------------------------------------------------------------------------------- /src/script_interface/Profiler.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "Profiler.h" 3 | 4 | Profiler::Profiler(const char* p_name) : m_name(p_name) 5 | { 6 | m_timer.start(); 7 | } 8 | 9 | Profiler::~Profiler() {} 10 | 11 | STDMETHODIMP Profiler::Print() 12 | { 13 | FB2K_console_formatter() << "FbProfiler (" << m_name << "): " << static_cast(m_timer.query() * 1000) << " ms"; 14 | return S_OK; 15 | } 16 | 17 | STDMETHODIMP Profiler::Reset() 18 | { 19 | m_timer.start(); 20 | return S_OK; 21 | } 22 | 23 | STDMETHODIMP Profiler::get_Time(int* p) 24 | { 25 | if (!p) return E_POINTER; 26 | 27 | *p = static_cast(m_timer.query() * 1000); 28 | return S_OK; 29 | } 30 | -------------------------------------------------------------------------------- /src/resource/cfgDark.cfg: -------------------------------------------------------------------------------- 1 | # Generated by JScript Panel 2 | style.default=font:Courier New,size:10,fore:#ffffff,back:#000000 3 | style.comment=italics,fore:#adadad 4 | style.keyword=fore:#78e087 5 | style.indentifier=$(style.default) 6 | style.string=fore:#dcdc71 7 | style.number=fore:#74ffff 8 | style.operator=fore:#87e078 9 | style.linenumber=font:Courier New,size:8,fore:#777777 10 | style.bracelight=bold,fore:#379b9b 11 | style.bracebad=$(style.bracelight),back:#0000ff 12 | style.selection.fore= 13 | style.selection.back=#660000 14 | style.selection.alpha=256 15 | style.caret.fore=#ffffff 16 | style.caret.width=1 17 | style.caret.line.back=#003300 18 | style.caret.line.back.alpha=256 19 | -------------------------------------------------------------------------------- /src/ui/ui_input_box.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "ui_input_box.h" 3 | 4 | CInputBox::CInputBox(const char* p_prompt, const char* p_caption, const char* p_value) : m_prompt(p_prompt), m_caption(p_caption), m_value(p_value) {} 5 | 6 | BOOL CInputBox::OnInitDialog(CWindow, LPARAM) 7 | { 8 | m_edit = GetDlgItem(IDC_EDIT_VALUE); 9 | m_label = GetDlgItem(IDC_LABEL_PROMPT); 10 | 11 | uSetWindowText(m_hWnd, m_caption); 12 | uSetWindowText(m_label, m_prompt); 13 | uSetWindowText(m_edit, m_value); 14 | CenterWindow(); 15 | return FALSE; 16 | } 17 | 18 | void CInputBox::OnCloseCmd(UINT, int nID, CWindow) 19 | { 20 | uGetWindowText(m_edit, m_value); 21 | EndDialog(nID); 22 | } 23 | -------------------------------------------------------------------------------- /src/resource/cfgRubyBlue.cfg: -------------------------------------------------------------------------------- 1 | # Generated by JScript Panel 2 | style.default=font:Courier New,size:10,fore:#ffffff,back:#121e31 3 | style.comment=italics,fore:#428bdd 4 | style.keyword=fore:#f8bb00 5 | style.indentifier=$(style.default) 6 | style.string=fore:#1dc116 7 | style.number=fore:#eddd3d 8 | style.operator=fore:#8aa6c1 9 | style.linenumber=font:Courier New,size:8,fore:#2b91af 10 | style.bracelight=bold,fore:#000000,back:#ffee62 11 | style.bracebad=bold,fore:#ff0000 12 | style.selection.fore= 13 | style.selection.back=#38566f 14 | style.selection.alpha=256 15 | style.caret.fore=#ffffff 16 | style.caret.width=1 17 | style.caret.line.back=#253e5a 18 | style.caret.line.back.alpha=256 19 | -------------------------------------------------------------------------------- /src/script_interface/ThemeManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "script_interface.h" 3 | 4 | class ThemeManager : public IDisposableImpl4 5 | { 6 | protected: 7 | ThemeManager(HWND hwnd, BSTR classlist); 8 | ~ThemeManager(); 9 | 10 | void FinalRelease() override; 11 | 12 | HTHEME m_theme = nullptr; 13 | int m_partid = 0; 14 | int m_stateid = 0; 15 | 16 | public: 17 | STDMETHODIMP DrawThemeBackground(IGdiGraphics* gr, int x, int y, int w, int h, int clip_x, int clip_y, int clip_w, int clip_h) override; 18 | STDMETHODIMP IsThemePartDefined(int partid, int stateid, VARIANT_BOOL* p) override; 19 | STDMETHODIMP SetPartAndStateID(int partid, int stateid) override; 20 | }; 21 | -------------------------------------------------------------------------------- /scintilla/src/DBCS.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file DBCS.h 3 | ** Functions to handle DBCS double byte encodings like Shift-JIS. 4 | **/ 5 | // Copyright 2017 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef DBCS_H 9 | #define DBCS_H 10 | 11 | namespace Scintilla { 12 | 13 | constexpr bool IsDBCSCodePage(int codePage) noexcept { 14 | return codePage == 932 15 | || codePage == 936 16 | || codePage == 949 17 | || codePage == 950 18 | || codePage == 1361; 19 | } 20 | 21 | bool DBCSIsLeadByte(int codePage, char ch) noexcept; 22 | 23 | } 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /scintilla/include/ILoader.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file ILoader.h 3 | ** Interface for loading into a Scintilla document from a background thread. 4 | **/ 5 | // Copyright 1998-2017 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef ILOADER_H 9 | #define ILOADER_H 10 | 11 | #include "Sci_Position.h" 12 | 13 | class ILoader { 14 | public: 15 | virtual int SCI_METHOD Release() = 0; 16 | // Returns a status code from SC_STATUS_* 17 | virtual int SCI_METHOD AddData(const char *data, Sci_Position length) = 0; 18 | virtual void * SCI_METHOD ConvertToDocument() = 0; 19 | }; 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /component/samples/basic/ColourPicker.txt: -------------------------------------------------------------------------------- 1 | // ==PREPROCESSOR== 2 | // @name "ColourPicker" 3 | // @author "marc2003" 4 | // @import "%fb2k_component_path%docs\flags.txt" 5 | // @import "%fb2k_component_path%docs\helpers.txt" 6 | // ==/PREPROCESSOR== 7 | 8 | var colour = RGB(255, 0, 0); 9 | var font = gdi.Font('Segoe UI', 16, 1); 10 | 11 | function on_paint(gr) { 12 | gr.FillSolidRect(0, 0, window.Width, window.Height, colour); 13 | gr.FillSolidRect(0, 0, window.Width, 24, RGB(0, 0, 0)); 14 | gr.GdiDrawText('Click to open ColourPicker', font, RGB(255, 255, 255), 0, 0, window.Width, 24, DT_CENTER); 15 | } 16 | 17 | function on_mouse_lbtn_up() { 18 | colour = utils.ColourPicker(window.ID, colour); 19 | window.Repaint(); 20 | } 21 | -------------------------------------------------------------------------------- /scintilla/src/Catalogue.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file Catalogue.h 3 | ** Lexer infrastructure. 4 | ** Contains a list of LexerModules which can be searched to find a module appropriate for a 5 | ** particular language. 6 | **/ 7 | // Copyright 1998-2010 by Neil Hodgson 8 | // The License.txt file describes the conditions under which this software may be distributed. 9 | 10 | #ifndef CATALOGUE_H 11 | #define CATALOGUE_H 12 | 13 | namespace Scintilla { 14 | 15 | class Catalogue { 16 | public: 17 | static const LexerModule *Find(int language); 18 | static const LexerModule *Find(const char *languageName); 19 | static void AddLexerModule(LexerModule *plm); 20 | }; 21 | 22 | } 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /src/panel_properties.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "helpers.h" 3 | 4 | class panel_properties 5 | { 6 | public: 7 | using property_map = std::map; 8 | 9 | static int g_sizeof(VARTYPE p_vt); 10 | static void g_get(const property_map& data, stream_writer* writer, abort_callback& abort) throw(); 11 | static void g_set(property_map& data, stream_reader* reader, abort_callback& abort) throw(); 12 | 13 | bool get_property(const char* p_key, VARIANT& p_out); 14 | void get(stream_writer* writer, abort_callback& abort) const throw(); 15 | void set(stream_reader* reader, abort_callback& abort) throw(); 16 | void set_property(const char* p_key, const VARIANT& p_val); 17 | 18 | property_map m_map; 19 | }; 20 | -------------------------------------------------------------------------------- /component/samples/complete/vbs/download.vbs: -------------------------------------------------------------------------------- 1 | If (WScript.Arguments.Count <> 2) Then 2 | WScript.Quit 3 | End If 4 | 5 | url = WScript.Arguments(0) 6 | file = WScript.Arguments(1) 7 | 8 | Set fso = CreateObject("Scripting.FileSystemObject") 9 | If fso.FileExists(file) Then 10 | Set fso = Nothing 11 | WScript.Quit 12 | End If 13 | 14 | Set xmlhttp = CreateObject("MSXML2.XMLHTTP") 15 | xmlhttp.open "GET", url, false 16 | xmlhttp.send() 17 | 18 | If xmlhttp.Status = 200 Then 19 | Set stream = CreateObject("ADODB.Stream") 20 | stream.Open 21 | stream.Type = 1 22 | stream.Write xmlhttp.ResponseBody 23 | stream.Position = 0 24 | stream.SaveToFile file 25 | stream.Close 26 | Set stream = Nothing 27 | End If 28 | 29 | Set fso = Nothing 30 | Set xmlhttp = Nothing 31 | -------------------------------------------------------------------------------- /src/drop_source_impl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class IDropSourceImpl : public ImplementCOMRefCounter 4 | { 5 | public: 6 | COM_QI_ONE(IDropSource) 7 | 8 | STDMETHODIMP GiveFeedback(DWORD dwEffect) override 9 | { 10 | m_effect = dwEffect; 11 | return DRAGDROP_S_USEDEFAULTCURSORS; 12 | } 13 | 14 | STDMETHODIMP QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState) override 15 | { 16 | if (fEscapePressed || (grfKeyState & MK_RBUTTON) || (grfKeyState & MK_MBUTTON)) 17 | { 18 | return DRAGDROP_S_CANCEL; 19 | } 20 | 21 | if (!(grfKeyState & MK_LBUTTON)) 22 | { 23 | return m_effect == DROPEFFECT_NONE ? DRAGDROP_S_CANCEL : DRAGDROP_S_DROP; 24 | } 25 | 26 | return S_OK; 27 | } 28 | 29 | private: 30 | DWORD m_effect = DROPEFFECT_NONE; 31 | }; 32 | -------------------------------------------------------------------------------- /scintilla/src/Position.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file Position.h 3 | ** Defines global type name Position in the Sci internal namespace. 4 | **/ 5 | // Copyright 2015 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef POSITION_H 9 | #define POSITION_H 10 | 11 | /** 12 | * A Position is a position within a document between two characters or at the beginning or end. 13 | * Sometimes used as a character index where it identifies the character after the position. 14 | * A Line is a document or screen line. 15 | */ 16 | 17 | namespace Sci { 18 | 19 | typedef ptrdiff_t Position; 20 | typedef ptrdiff_t Line; 21 | 22 | const Position invalidPosition = -1; 23 | 24 | } 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /src/panel_manager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "callback_data.h" 3 | 4 | class panel_manager 5 | { 6 | public: 7 | panel_manager(); 8 | 9 | using api_item = std::pair; 10 | 11 | static panel_manager& instance(); 12 | 13 | std::vector get_apis(); 14 | void add_window(CWindow hwnd); 15 | void notify_others(CWindow hwnd_except, pfc::refcounted_object_root* param); 16 | void post_msg_to_all(callback_id id, WPARAM wp = 0, LPARAM lp = 0); 17 | void post_msg_to_all_pointer(callback_id id, pfc::refcounted_object_root* param); 18 | void remove_window(CWindow hwnd); 19 | void unload_all(); 20 | 21 | private: 22 | static panel_manager instance_; 23 | 24 | std::set m_hwnds; 25 | std::vector m_apis; 26 | 27 | PFC_CLASS_NOT_COPYABLE_EX(panel_manager) 28 | }; 29 | -------------------------------------------------------------------------------- /src/ui/config.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "helpers.h" 3 | 4 | class config : public cfg_var 5 | { 6 | public: 7 | config(const GUID& p_guid); 8 | 9 | struct simple_key_val 10 | { 11 | pfc::string_simple key, value; 12 | }; 13 | 14 | using simple_map = std::map; 15 | 16 | void get_data_raw(stream_writer* p_stream, abort_callback& p_abort) override; 17 | void import(const char* content); 18 | void init_data(); 19 | void load_preset(size_t idx); 20 | void merge_data(const simple_map& data_map); 21 | void set_data_raw(stream_reader* p_stream, size_t p_sizehint, abort_callback& p_abort) override; 22 | 23 | WINDOWPLACEMENT m_conf_wndpl{}, m_property_wndpl{}; 24 | std::vector m_data; 25 | }; 26 | 27 | extern config g_config; 28 | -------------------------------------------------------------------------------- /docs/assets/css/style.scss: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | 4 | @import "{{ site.theme }}"; 5 | 6 | code.highlighter-rouge { 7 | background: rgba(60,60,60,0.33); 8 | border: 1px solid rgba(255, 255, 255, 0.15); 9 | color: #63c0f5; 10 | } 11 | 12 | header h1:before { 13 | content: ""; // override that silly ./ 14 | } 15 | 16 | header h1 { 17 | margin: 0; 18 | color: #e8535a; 19 | } 20 | 21 | header { 22 | border-bottom: 1px dashed #e8535a; 23 | } 24 | 25 | h1, h2, h3, h4, h5, h6 { 26 | color: #e8535a; 27 | } 28 | 29 | ul li { 30 | list-style-image: none; 31 | list-style: none; 32 | } 33 | 34 | ul li::before { 35 | content: "\2022"; 36 | color: #e8535a; 37 | font-weight: bold; 38 | display: inline-block; 39 | width: 1em; 40 | margin-left: -1em; 41 | } 42 | 43 | pre { 44 | background: rgba(35, 35, 35, 0.27) 45 | } 46 | -------------------------------------------------------------------------------- /src/script_interface/DropSourceAction.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "script_interface.h" 3 | 4 | class DropSourceAction : public IDisposableImpl4 5 | { 6 | protected: 7 | DropSourceAction(); 8 | ~DropSourceAction(); 9 | 10 | void FinalRelease() override; 11 | 12 | public: 13 | void Reset() 14 | { 15 | m_playlist_idx = 0; 16 | m_base = 0; 17 | m_to_select = true; 18 | m_effect = DROPEFFECT_NONE; 19 | } 20 | 21 | STDMETHODIMP get_Effect(UINT* p) override; 22 | STDMETHODIMP put_Base(UINT base) override; 23 | STDMETHODIMP put_Effect(UINT effect) override; 24 | STDMETHODIMP put_Playlist(UINT id) override; 25 | STDMETHODIMP put_ToSelect(VARIANT_BOOL to_select) override; 26 | 27 | DWORD m_effect = DROPEFFECT_NONE; 28 | bool m_to_select = true; 29 | size_t m_base = 0; 30 | size_t m_playlist_idx = 0; 31 | }; 32 | -------------------------------------------------------------------------------- /src/script_interface/script_interface.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "com_tools.h" 3 | #include "script_interface_h.h" 4 | 5 | #include "ContextMenuManager.h" 6 | #include "DropSourceAction.h" 7 | #include "FileInfo.h" 8 | #include "GdiBitmap.h" 9 | #include "GdiFont.h" 10 | #include "GdiGraphics.h" 11 | #include "GdiRawBitmap.h" 12 | #include "MainMenuManager.h" 13 | #include "MeasureStringInfo.h" 14 | #include "MenuObj.h" 15 | #include "MetadbHandle.h" 16 | #include "MetadbHandleList.h" 17 | #include "PlaybackQueueItem.h" 18 | #include "PlayingItemLocation.h" 19 | #include "Profiler.h" 20 | #include "ThemeManager.h" 21 | #include "TitleFormat.h" 22 | #include "Tooltip.h" 23 | #include "UiSelectionHolder.h" 24 | 25 | #include "Console.h" 26 | #include "Fb.h" 27 | #include "Gdi.h" 28 | #include "Plman.h" 29 | #include "Utils.h" 30 | #include "Window.h" 31 | -------------------------------------------------------------------------------- /component/docs/Notes & Hints.txt: -------------------------------------------------------------------------------- 1 | 1 If anything goes wrong, check the popup window/console. It should tell you where the code is 2 | that caused the error. 3 | 2 Error handling is useful to create more stable scripts. 4 | 3 Don't call repaint functions such as window.Repaint() in callback function on_size() {}, 5 | especially in pseudo transparent mode. 6 | 4 Don't try to assign parameter "gr" from function on_paint(gr) {} with other value, nor try 7 | to store "gr" in another variable. 8 | 5 Consider using Dispose() methods where you can to free up memory. See interfaces.txt for 9 | where it's supported. 10 | 6 Remember to retrieve window width and height in on_size() callback, because their values 11 | during startup is not reliable. 12 | 7 It's NOT recommended to create objects in callback function on_paint(), since it will be 13 | called frenquently. 14 | -------------------------------------------------------------------------------- /src/host_drop_target.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "panel_window.h" 3 | 4 | class host_drop_target : public IDropTargetImpl 5 | { 6 | protected: 7 | virtual void FinalRelease() {} 8 | 9 | public: 10 | host_drop_target(panel_window* host); 11 | ~host_drop_target(); 12 | 13 | COM_QI_ONE(IDropTarget) 14 | 15 | HRESULT OnDragEnter(IDataObject* pDataObj, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect) override; 16 | HRESULT OnDragLeave() override; 17 | HRESULT OnDragOver(DWORD grfKeyState, POINTL pt, DWORD* pdwEffect) override; 18 | HRESULT OnDrop(IDataObject* pDataObj, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect) override; 19 | void invoke(callback_id id, DWORD keyState, const POINTL& pt, IDropSourceAction* action); 20 | 21 | private: 22 | DropSourceAction* m_action; 23 | DWORD m_allowed_effect = DROPEFFECT_NONE; 24 | panel_window* m_host; 25 | }; 26 | -------------------------------------------------------------------------------- /scintilla/lexlib/PropSetSimple.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file PropSetSimple.h 3 | ** A basic string to string map. 4 | **/ 5 | // Copyright 1998-2009 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef PROPSETSIMPLE_H 9 | #define PROPSETSIMPLE_H 10 | 11 | namespace Scintilla { 12 | 13 | class PropSetSimple { 14 | void *impl; 15 | void Set(const char *keyVal); 16 | public: 17 | PropSetSimple(); 18 | virtual ~PropSetSimple(); 19 | void Set(const char *key, const char *val, size_t lenKey, size_t lenVal); 20 | void SetMultiple(const char *); 21 | const char *Get(const char *key) const; 22 | int GetExpanded(const char *key, char *result) const; 23 | int GetInt(const char *key, int defaultValue=0) const; 24 | }; 25 | 26 | } 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /src/script_interface/MenuObj.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "script_interface.h" 3 | 4 | class MenuObj : public IDisposableImpl4 5 | { 6 | protected: 7 | MenuObj(CWindow wnd_parent); 8 | ~MenuObj(); 9 | 10 | void FinalRelease() override; 11 | 12 | CWindow m_wnd_parent = nullptr; 13 | HMENU m_hMenu = nullptr; 14 | bool m_has_detached = false; 15 | 16 | public: 17 | STDMETHODIMP get__ID(HMENU* p) override; 18 | STDMETHODIMP AppendMenuItem(UINT flags, UINT item_id, BSTR text) override; 19 | STDMETHODIMP AppendMenuSeparator() override; 20 | STDMETHODIMP AppendTo(IMenuObj* parent, UINT flags, BSTR text) override; 21 | STDMETHODIMP CheckMenuItem(UINT item_id, VARIANT_BOOL check) override; 22 | STDMETHODIMP CheckMenuRadioItem(UINT first, UINT last, UINT selected) override; 23 | STDMETHODIMP TrackPopupMenu(int x, int y, UINT flags, UINT* p) override; 24 | }; 25 | -------------------------------------------------------------------------------- /src/script_interface/UiSelectionHolder.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "UiSelectionHolder.h" 3 | 4 | UiSelectionHolder::UiSelectionHolder(const ui_selection_holder::ptr& holder) : m_holder(holder) {} 5 | UiSelectionHolder::~UiSelectionHolder() {} 6 | 7 | void UiSelectionHolder::FinalRelease() 8 | { 9 | m_holder.release(); 10 | } 11 | 12 | STDMETHODIMP UiSelectionHolder::SetPlaylistSelectionTracking() 13 | { 14 | m_holder->set_playlist_selection_tracking(); 15 | return S_OK; 16 | } 17 | 18 | STDMETHODIMP UiSelectionHolder::SetPlaylistTracking() 19 | { 20 | m_holder->set_playlist_tracking(); 21 | return S_OK; 22 | } 23 | 24 | STDMETHODIMP UiSelectionHolder::SetSelection(IMetadbHandleList* handles) 25 | { 26 | metadb_handle_list* handles_ptr = nullptr; 27 | GET_PTR(handles, handles_ptr); 28 | 29 | m_holder->set_selection(*handles_ptr); 30 | return S_OK; 31 | } 32 | -------------------------------------------------------------------------------- /scintilla/src/IntegerRectangle.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file IntegerRectangle.h 3 | ** A rectangle with integer coordinates. 4 | **/ 5 | // Copyright 2018 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef INTEGERRECTANGLE_H 9 | #define INTEGERRECTANGLE_H 10 | 11 | namespace Scintilla { 12 | 13 | struct IntegerRectangle { 14 | int left; 15 | int top; 16 | int right; 17 | int bottom; 18 | 19 | explicit IntegerRectangle(PRectangle rc) noexcept : 20 | left(static_cast(rc.left)), top(static_cast(rc.top)), 21 | right(static_cast(rc.right)), bottom(static_cast(rc.bottom)) { 22 | } 23 | int Width() const noexcept { return right - left; } 24 | int Height() const noexcept { return bottom - top; } 25 | }; 26 | 27 | } 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /src/cpp.hint: -------------------------------------------------------------------------------- 1 | // Hint files help the Visual Studio IDE interpret Visual C++ identifiers 2 | // such as names of functions and macros. 3 | // For more information see https://go.microsoft.com/fwlink/?linkid=865984 4 | #define BEGIN_MSG_MAP_EX(theClass) public: BOOL m_bMsgHandled; BOOL IsMsgHandled() const { return m_bMsgHandled; } void SetMsgHandled(BOOL bHandled) { m_bMsgHandled = bHandled; } BOOL ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& lResult, DWORD dwMsgMapID = 0) { BOOL bOldMsgHandled = m_bMsgHandled; BOOL bRet = _ProcessWindowMessage(hWnd, uMsg, wParam, lParam, lResult, dwMsgMapID); m_bMsgHandled = bOldMsgHandled; return bRet; } BOOL _ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& lResult, DWORD dwMsgMapID) { BOOL bHandled = TRUE; (hWnd); (uMsg); (wParam); (lParam); (lResult); (bHandled); switch(dwMsgMapID) { case 0: 5 | -------------------------------------------------------------------------------- /src/script_interface/FileInfo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "script_interface.h" 3 | 4 | class FileInfo : public IDisposableImpl4 5 | { 6 | protected: 7 | FileInfo(file_info_impl* p_info_ptr); 8 | ~FileInfo(); 9 | 10 | void FinalRelease() override; 11 | 12 | file_info_impl* m_info_ptr; 13 | 14 | public: 15 | STDMETHODIMP get__ptr(void** pp) override; 16 | STDMETHODIMP InfoFind(BSTR name, int* p) override; 17 | STDMETHODIMP InfoName(UINT idx, BSTR* p) override; 18 | STDMETHODIMP InfoValue(UINT idx, BSTR* p) override; 19 | STDMETHODIMP MetaFind(BSTR name, int* p) override; 20 | STDMETHODIMP MetaName(UINT idx, BSTR* p) override; 21 | STDMETHODIMP MetaValue(UINT idx, UINT vidx, BSTR* p) override; 22 | STDMETHODIMP MetaValueCount(UINT idx, UINT* p) override; 23 | STDMETHODIMP get_InfoCount(UINT* p) override; 24 | STDMETHODIMP get_MetaCount(UINT* p) override; 25 | }; 26 | -------------------------------------------------------------------------------- /src/script_interface/PlayingItemLocation.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "PlayingItemLocation.h" 3 | 4 | PlayingItemLocation::PlayingItemLocation(bool isValid, size_t playlistIndex, size_t playlistItemIndex) : m_isValid(isValid), m_playlistIndex(playlistIndex), m_playlistItemIndex(playlistItemIndex) {} 5 | 6 | STDMETHODIMP PlayingItemLocation::get_IsValid(VARIANT_BOOL* p) 7 | { 8 | if (!p) return E_POINTER; 9 | 10 | *p = TO_VARIANT_BOOL(m_isValid); 11 | return S_OK; 12 | } 13 | 14 | STDMETHODIMP PlayingItemLocation::get_PlaylistIndex(int* p) 15 | { 16 | if (!p) return E_POINTER; 17 | 18 | *p = m_isValid ? static_cast(m_playlistIndex) : -1; 19 | return S_OK; 20 | } 21 | 22 | STDMETHODIMP PlayingItemLocation::get_PlaylistItemIndex(int* p) 23 | { 24 | if (!p) return E_POINTER; 25 | 26 | *p = m_isValid ? static_cast(m_playlistItemIndex) : -1; 27 | return S_OK; 28 | } 29 | -------------------------------------------------------------------------------- /src/script_interface/Console.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "Console.h" 3 | 4 | Console::Console() {} 5 | Console::~Console() {} 6 | 7 | STDMETHODIMP Console::Log(SAFEARRAY* p) 8 | { 9 | pfc::string8_fast str; 10 | LONG nLBound = 0, nUBound = -1; 11 | 12 | HRESULT hr = SafeArrayGetLBound(p, 1, &nLBound); 13 | if (SUCCEEDED(hr)) hr = SafeArrayGetUBound(p, 1, &nUBound); 14 | if (FAILED(hr)) return hr; 15 | 16 | for (LONG i = nLBound; i <= nUBound; ++i) 17 | { 18 | _variant_t var; 19 | LONG n = i; 20 | 21 | if (FAILED(SafeArrayGetElement(p, &n, &var))) 22 | continue; 23 | 24 | if (FAILED(VariantChangeType(&var, &var, VARIANT_ALPHABOOL, VT_BSTR))) 25 | continue; 26 | 27 | str.add_string(string_utf8_from_wide(var.bstrVal)); 28 | 29 | if (i < nUBound) 30 | { 31 | str.add_byte(' '); 32 | } 33 | } 34 | FB2K_console_formatter() << str; 35 | return S_OK; 36 | } 37 | -------------------------------------------------------------------------------- /src/script_interface/DropSourceAction.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "DropSourceAction.h" 3 | 4 | DropSourceAction::DropSourceAction() {} 5 | 6 | DropSourceAction::~DropSourceAction() {} 7 | 8 | void DropSourceAction::FinalRelease() {} 9 | 10 | STDMETHODIMP DropSourceAction::get_Effect(UINT* p) 11 | { 12 | if (!p) return E_POINTER; 13 | 14 | *p = m_effect; 15 | return S_OK; 16 | } 17 | 18 | STDMETHODIMP DropSourceAction::put_Base(UINT base) 19 | { 20 | m_base = base; 21 | return S_OK; 22 | } 23 | 24 | STDMETHODIMP DropSourceAction::put_Effect(UINT effect) 25 | { 26 | m_effect = effect; 27 | return S_OK; 28 | } 29 | 30 | STDMETHODIMP DropSourceAction::put_Playlist(UINT id) 31 | { 32 | m_playlist_idx = id; 33 | return S_OK; 34 | } 35 | 36 | STDMETHODIMP DropSourceAction::put_ToSelect(VARIANT_BOOL select) 37 | { 38 | m_to_select = select != VARIANT_FALSE; 39 | return S_OK; 40 | } 41 | -------------------------------------------------------------------------------- /src/foo_jscript_panel.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | // Script TypeLib 4 | ITypeLibPtr g_typelib; 5 | 6 | namespace jsp 7 | { 8 | DECLARE_COMPONENT_VERSION(component_name, component_version, component_info); 9 | VALIDATE_COMPONENT_FILENAME(component_dll_name); 10 | 11 | CAppModule _Module; 12 | GdiplusScope scope; 13 | 14 | extern "C" BOOL WINAPI DllMain(HINSTANCE ins, DWORD reason, LPVOID lp) 15 | { 16 | switch (reason) 17 | { 18 | case DLL_PROCESS_ATTACH: 19 | { 20 | pfc::string8_fast path; 21 | uGetModuleFileName(ins, path); 22 | if (FAILED(LoadTypeLibEx(string_wide_from_utf8_fast(path), REGKIND_NONE, &g_typelib))) return FALSE; 23 | 24 | Scintilla_RegisterClasses(ins); 25 | _Module.Init(nullptr, ins); 26 | } 27 | break; 28 | case DLL_PROCESS_DETACH: 29 | _Module.Term(); 30 | Scintilla_ReleaseResources(); 31 | break; 32 | } 33 | return TRUE; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /scintilla/win32/PlatWin.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file PlatWin.h 3 | ** Implementation of platform facilities on Windows. 4 | **/ 5 | // Copyright 1998-2011 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef PLATWIN_H 9 | #define PLATWIN_H 10 | 11 | namespace Scintilla { 12 | 13 | extern void Platform_Initialise(void *hInstance); 14 | extern void Platform_Finalise(bool fromDllMain); 15 | 16 | constexpr RECT RectFromPRectangle(PRectangle prc) noexcept { 17 | RECT rc = { static_cast(prc.left), static_cast(prc.top), 18 | static_cast(prc.right), static_cast(prc.bottom) }; 19 | return rc; 20 | } 21 | 22 | #if defined(USE_D2D) 23 | extern bool LoadD2D(); 24 | extern ID2D1Factory *pD2DFactory; 25 | extern IDWriteFactory *pIDWriteFactory; 26 | #endif 27 | 28 | } 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /component/samples/basic/SimpleFollowCursor.txt: -------------------------------------------------------------------------------- 1 | // ==PREPROCESSOR== 2 | // @name "SimpleFollowCursor" 3 | // @import "%fb2k_component_path%docs\flags.txt" 4 | // @import "%fb2k_component_path%docs\helpers.txt" 5 | // ==/PREPROCESSOR== 6 | 7 | var handle = fb.GetFocusItem(); 8 | var font = gdi.Font('Segoe UI', 14, 0); 9 | var tfo = fb.TitleFormat('%title%[ - %artist%]'); 10 | 11 | function on_item_focus_change() { 12 | handle = fb.GetFocusItem(); 13 | window.Repaint(); 14 | } 15 | 16 | function on_playlist_switch() { 17 | //because on_item_focus_change isn't called when the user switches playlists 18 | //we must invoke it manually inside this callback 19 | on_item_focus_change(); 20 | } 21 | 22 | function on_paint(gr) { 23 | if (handle) { 24 | gr.GdiDrawText(tfo.EvalWithMetadb(handle), font, RGB(0, 0, 0), 0, 0, window.Width, window.Height, DT_VCENTER | DT_CENTER | DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /component/licenses/PFC.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2002-2019 Peter Pawlowski 2 | 3 | This software is provided 'as-is', without any express or implied 4 | warranty. In no event will the authors be held liable for any damages 5 | arising from the use of this software. 6 | 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it 9 | freely, subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not 12 | claim that you wrote the original software. If you use this software 13 | in a product, an acknowledgment in the product documentation would be 14 | appreciated but is not required. 15 | 2. Altered source versions must be plainly marked as such, and must not be 16 | misrepresented as being the original software. 17 | 3. This notice may not be removed or altered from any source distribution. 18 | -------------------------------------------------------------------------------- /scintilla/lexlib/LexerSimple.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file LexerSimple.h 3 | ** A simple lexer with no state. 4 | **/ 5 | // Copyright 1998-2010 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef LEXERSIMPLE_H 9 | #define LEXERSIMPLE_H 10 | 11 | namespace Scintilla { 12 | 13 | // A simple lexer with no state 14 | class LexerSimple : public LexerBase { 15 | const LexerModule *module; 16 | std::string wordLists; 17 | public: 18 | explicit LexerSimple(const LexerModule *module_); 19 | const char * SCI_METHOD DescribeWordListSets() override; 20 | void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) override; 21 | void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) override; 22 | }; 23 | 24 | } 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /scintilla/src/FontQuality.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file FontQuality.h 3 | ** Definitions to control font anti-aliasing. 4 | ** Redefine constants from Scintilla.h to avoid including Scintilla.h in PlatWin.cxx. 5 | **/ 6 | // Copyright 1998-2009 by Neil Hodgson 7 | // The License.txt file describes the conditions under which this software may be distributed. 8 | 9 | #ifndef FONTQUALITY_H 10 | #define FONTQUALITY_H 11 | 12 | namespace Scintilla { 13 | 14 | // These definitions match Scintilla.h 15 | #define SC_EFF_QUALITY_MASK 0xF 16 | #define SC_EFF_QUALITY_DEFAULT 0 17 | #define SC_EFF_QUALITY_NON_ANTIALIASED 1 18 | #define SC_EFF_QUALITY_ANTIALIASED 2 19 | #define SC_EFF_QUALITY_LCD_OPTIMIZED 3 20 | 21 | // These definitions must match SC_TECHNOLOGY_* in Scintilla.h 22 | #define SCWIN_TECH_GDI 0 23 | #define SCWIN_TECH_DIRECTWRITE 1 24 | 25 | } 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /docs/foo_jscript_panel/WINE.md: -------------------------------------------------------------------------------- 1 | ## WINE 2 | 3 | Since this subject occasionally crops up, I've tested `JScript Panel` under `WINE` with `Ubuntu 19.04`. 4 | 5 | Use this command to install `WINE`: 6 | 7 | ``` 8 | sudo apt-get install wine32 9 | ``` 10 | 11 | Then run the following: 12 | 13 | ``` 14 | sudo apt-get install cabextract 15 | wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks 16 | chmod +x winetricks 17 | sh winetricks gdiplus_winxp wsh57 fontsmooth=rgb msscript ie8 18 | ``` 19 | 20 | - Note that last command appears to download `Windows XP SP3` which is just over 300MB in size! 21 | 22 | That should be it! 23 | 24 | For scripts that require custom fonts, I found that copying fonts to `drive_c\windows\fonts` in the `.wine` folder didn't work but creating a `.fonts` folder inside your `HOME` directory works fine. 25 | 26 | Although the component and most scripts work fine, you may find there are individual scripts that won't work. -------------------------------------------------------------------------------- /scintilla/include/Sci_Position.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file Sci_Position.h 3 | ** Define the Sci_Position type used in Scintilla's external interfaces. 4 | ** These need to be available to clients written in C so are not in a C++ namespace. 5 | **/ 6 | // Copyright 2015 by Neil Hodgson 7 | // The License.txt file describes the conditions under which this software may be distributed. 8 | 9 | #ifndef SCI_POSITION_H 10 | #define SCI_POSITION_H 11 | 12 | #include 13 | 14 | // Basic signed type used throughout interface 15 | typedef ptrdiff_t Sci_Position; 16 | 17 | // Unsigned variant used for ILexer::Lex and ILexer::Fold 18 | typedef size_t Sci_PositionU; 19 | 20 | // For Sci_CharacterRange which is defined as long to be compatible with Win32 CHARRANGE 21 | typedef long Sci_PositionCR; 22 | 23 | #ifdef _WIN32 24 | #define SCI_METHOD __stdcall 25 | #else 26 | #define SCI_METHOD 27 | #endif 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /component/licenses/Scintilla + SciTE.txt: -------------------------------------------------------------------------------- 1 | License for Scintilla and SciTE 2 | 3 | Copyright 1998-2003 by Neil Hodgson 4 | 5 | All Rights Reserved 6 | 7 | Permission to use, copy, modify, and distribute this software and its 8 | documentation for any purpose and without fee is hereby granted, 9 | provided that the above copyright notice appear in all copies and that 10 | both that copyright notice and this permission notice appear in 11 | supporting documentation. 12 | 13 | NEIL HODGSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 14 | SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 15 | AND FITNESS, IN NO EVENT SHALL NEIL HODGSON BE LIABLE FOR ANY 16 | SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 17 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 18 | WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 19 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE 20 | OR PERFORMANCE OF THIS SOFTWARE. 21 | -------------------------------------------------------------------------------- /scintilla/lexlib/Accessor.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file Accessor.h 3 | ** Interfaces between Scintilla and lexers. 4 | **/ 5 | // Copyright 1998-2010 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef ACCESSOR_H 9 | #define ACCESSOR_H 10 | 11 | namespace Scintilla { 12 | 13 | enum { wsSpace=1, wsTab=2, wsSpaceTab=4, wsInconsistent=8 }; 14 | 15 | class Accessor; 16 | class WordList; 17 | class PropSetSimple; 18 | 19 | typedef bool (*PFNIsCommentLeader)(Accessor &styler, Sci_Position pos, Sci_Position len); 20 | 21 | class Accessor : public LexAccessor { 22 | public: 23 | PropSetSimple *pprops; 24 | Accessor(IDocument *pAccess_, PropSetSimple *pprops_); 25 | int GetPropertyInt(const char *, int defaultValue=0) const; 26 | int IndentAmount(Sci_Position line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0); 27 | }; 28 | 29 | } 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /scintilla/win32/SciTE.properties: -------------------------------------------------------------------------------- 1 | command.build.SConstruct=scons.bat . 2 | command.name.1.SConstruct=scons clean 3 | command.1.SConstruct=scons.bat --clean . 4 | 5 | command.build.*.mak=nmake -f $(FileNameExt) DEBUG=1 QUIET=1 6 | command.name.1.*.mak=nmake clean 7 | command.1.*.mak=nmake -f $(FileNameExt) clean 8 | command.name.2.*.mak=Borland Make 9 | command.2.*.mak=make -f $(FileNameExt) 10 | command.subsystem.2.*.mak=0 11 | command.name.3.*.mak=make clean 12 | command.3.*.mak=make -f $(FileNameExt) clean 13 | command.name.4.*.mak=make debug 14 | command.4.*.mak=make DEBUG=1 -f $(FileNameExt) 15 | command.name.5.*.mak=nmake debug 16 | command.5.*.mak=nmake DEBUG=1 -f $(FileNameExt) 17 | # SciTE.properties is the per directory local options file and can be used to override 18 | # settings made in SciTEGlobal.properties 19 | command.build.*.cxx=nmake -f scintilla.mak DEBUG=1 QUIET=1 20 | command.build.*.h=nmake -f scintilla.mak DEBUG=1 QUIET=1 21 | command.build.*.rc=nmake -f scintilla.mak DEBUG=1 QUIET=1 22 | -------------------------------------------------------------------------------- /docs/foo_jscript_panel/Gallery.md: -------------------------------------------------------------------------------- 1 | ## Gallery 2 | 3 | - Not all `Samples` are included here. 4 | 5 | ## JS Smooth Browser by [Br3tt aka Falstaff](https://www.deviantart.com/br3tt) 6 | 7 | ![smooth_browser](../images/smooth_browser.png) 8 | 9 | ## JS Smooth Playlist by [Br3tt aka Falstaff](https://www.deviantart.com/br3tt) 10 | 11 | ![smooth_playlist](../images/smooth_playlist.png) 12 | 13 | ## JSPlaylist by [Br3tt aka Falstaff](https://www.deviantart.com/br3tt) 14 | 15 | ![jsplaylist](../images/jsplaylist.png) 16 | 17 | ### Album Art 18 | 19 | ![art](../images/album_art.png) 20 | 21 | ### Allmusic 22 | 23 | ![allmusic](../images/allmusic.png) 24 | 25 | ### Last.fm Bio 26 | 27 | ![bio](../images/bio.png) 28 | 29 | ## Last.fm Similar Artists 30 | 31 | ![similar](../images/similar.png) 32 | 33 | ## MusicBrainz 34 | 35 | ![musicbrainz](../images/musicbrainz.png) 36 | 37 | ## Properties 38 | 39 | ![properties](../images/properties.png) 40 | 41 | ## Thumbs 42 | 43 | ![thumbs](../images/thumbs.png) 44 | -------------------------------------------------------------------------------- /scintilla/lexlib/StringCopy.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file StringCopy.h 3 | ** Safe string copy function which always NUL terminates. 4 | ** ELEMENTS macro for determining array sizes. 5 | **/ 6 | // Copyright 2013 by Neil Hodgson 7 | // The License.txt file describes the conditions under which this software may be distributed. 8 | 9 | #ifndef STRINGCOPY_H 10 | #define STRINGCOPY_H 11 | 12 | namespace Scintilla { 13 | 14 | // Safer version of string copy functions like strcpy, wcsncpy, etc. 15 | // Instantiate over fixed length strings of both char and wchar_t. 16 | // May truncate if source doesn't fit into dest with room for NUL. 17 | 18 | template 19 | void StringCopy(T (&dest)[count], const T* source) { 20 | for (size_t i=0; i 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef CHARCLASSIFY_H 9 | #define CHARCLASSIFY_H 10 | 11 | namespace Scintilla { 12 | 13 | class CharClassify { 14 | public: 15 | CharClassify(); 16 | 17 | enum cc { ccSpace, ccNewLine, ccWord, ccPunctuation }; 18 | void SetDefaultCharClasses(bool includeWordClass); 19 | void SetCharClasses(const unsigned char *chars, cc newCharClass); 20 | int GetCharsOfClass(cc characterClass, unsigned char *buffer) const; 21 | cc GetClass(unsigned char ch) const noexcept { return static_cast(charClass[ch]);} 22 | bool IsWord(unsigned char ch) const noexcept { return static_cast(charClass[ch]) == ccWord;} 23 | 24 | private: 25 | enum { maxChar=256 }; 26 | unsigned char charClass[maxChar]; // not type cc to save space 27 | }; 28 | 29 | } 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /component/samples/complete/volume.txt: -------------------------------------------------------------------------------- 1 | // ==PREPROCESSOR== 2 | // @name "Volume" 3 | // @author "marc2003" 4 | // @import "%fb2k_component_path%samples\complete\js\lodash.min.js" 5 | // @import "%fb2k_component_path%samples\complete\js\helpers.js" 6 | // @import "%fb2k_component_path%samples\complete\js\volume.js" 7 | // ==/PREPROCESSOR== 8 | 9 | var volume = new _.volume(0, 0, 0, 0); 10 | volume.c1 = _.RGB(50, 50, 50); 11 | volume.c2 = _.RGB(196, 30, 35); 12 | 13 | function on_size() { 14 | volume.w = window.Width; 15 | volume.h = window.Height; 16 | } 17 | 18 | function on_paint(gr) { 19 | gr.FillSolidRect(volume.x, volume.y, volume.w, volume.h, volume.c1); 20 | gr.FillSolidRect(volume.x, volume.y, volume.pos(), volume.h, volume.c2); 21 | } 22 | 23 | function on_volume_change() { 24 | volume.volume_change(); 25 | } 26 | 27 | function on_mouse_wheel(s) { 28 | volume.wheel(s); 29 | } 30 | 31 | function on_mouse_move(x, y) { 32 | volume.move(x, y); 33 | } 34 | 35 | function on_mouse_lbtn_down(x, y) { 36 | volume.lbtn_down(x, y); 37 | } 38 | 39 | function on_mouse_lbtn_up(x, y) { 40 | volume.lbtn_up(x, y); 41 | } 42 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (C) 2015-2020 marc2003 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /src/script_interface/GdiBitmap.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "script_interface.h" 3 | 4 | class GdiBitmap : public GdiObj 5 | { 6 | protected: 7 | GdiBitmap(Gdiplus::Bitmap* p); 8 | 9 | public: 10 | STDMETHODIMP ApplyAlpha(BYTE alpha, IGdiBitmap** pp) override; 11 | STDMETHODIMP ApplyMask(IGdiBitmap* mask, VARIANT_BOOL* p) override; 12 | STDMETHODIMP Clone(float x, float y, float w, float h, IGdiBitmap** pp) override; 13 | STDMETHODIMP CreateRawBitmap(IGdiRawBitmap** pp) override; 14 | STDMETHODIMP GetColourSchemeJSON(UINT count, BSTR* p) override; 15 | STDMETHODIMP GetGraphics(IGdiGraphics** pp) override; 16 | STDMETHODIMP InvertColours(IGdiBitmap** pp) override; 17 | STDMETHODIMP ReleaseGraphics(IGdiGraphics* p) override; 18 | STDMETHODIMP Resize(UINT w, UINT h, int interpolationMode, IGdiBitmap** pp) override; 19 | STDMETHODIMP RotateFlip(UINT mode) override; 20 | STDMETHODIMP SaveAs(BSTR path, BSTR format, VARIANT_BOOL* p) override; 21 | STDMETHODIMP StackBlur(BYTE radius) override; 22 | STDMETHODIMP get_Height(UINT* p) override; 23 | STDMETHODIMP get_Width(UINT* p) override; 24 | }; 25 | -------------------------------------------------------------------------------- /component/docs/Preprocessors.txt: -------------------------------------------------------------------------------- 1 | DESCRIPTION 2 | All preprocessors are started with "==PREPROCESSOR==" and ended with "==/PREPROCESSOR==": 3 | 4 | // ==PREPROCESSOR== 5 | // ... 6 | // ==/PREPROCESSOR== 7 | 8 | And be aware that all preprocessors (directives) are case sensitive. 9 | 10 | DIRECTIVES 11 | Directives should be started with "@", and placed into a single comment. 12 | 13 | // @directive "value-here" 14 | 15 | IMPORT 16 | @import "path" 17 | Load external script from "path". These files should be UTF8 only (with or without BOM). 18 | You can place %fb2k_path%, %fb2k_component_path% and %fb2k_profile_path% in to "path", they 19 | will be expanded while parsing. 20 | 21 | NAME 22 | @name "name" 23 | 24 | VERSION 25 | @version "version" 26 | 27 | AUTHOR 28 | @author "author" 29 | 30 | As of v2.2.0, you can use double quotes in the name/author without escaping them. 31 | 32 | Example: 33 | // ==PREPROCESSOR== 34 | // @name "my sooper dooper script" 35 | // @author "marc" 36 | // @version "0.1" 37 | // @import "%fb2k_component_path%docs\flags.txt" 38 | // @import "%fb2k_component_path%docs\helpers.txt" 39 | // ==/PREPROCESSOR== 40 | -------------------------------------------------------------------------------- /scintilla/lexlib/WordList.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file WordList.h 3 | ** Hold a list of words. 4 | **/ 5 | // Copyright 1998-2010 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef WORDLIST_H 9 | #define WORDLIST_H 10 | 11 | namespace Scintilla { 12 | 13 | /** 14 | */ 15 | class WordList { 16 | // Each word contains at least one character - a empty word acts as sentinel at the end. 17 | char **words; 18 | char *list; 19 | int len; 20 | bool onlyLineEnds; ///< Delimited by any white space or only line ends 21 | int starts[256]; 22 | public: 23 | explicit WordList(bool onlyLineEnds_ = false); 24 | ~WordList(); 25 | operator bool() const; 26 | bool operator!=(const WordList &other) const; 27 | int Length() const; 28 | void Clear(); 29 | bool Set(const char *s); 30 | bool InList(const char *s) const; 31 | bool InListAbbreviated(const char *s, const char marker) const; 32 | bool InListAbridged(const char *s, const char marker) const; 33 | const char *WordAt(int n) const; 34 | }; 35 | 36 | } 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /scintilla/src/ElapsedPeriod.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file ElapsedPeriod.h 3 | ** Encapsulate C++ to simplify use. 4 | **/ 5 | // Copyright 2018 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef ELAPSEDPERIOD_H 9 | #define ELAPSEDPERIOD_H 10 | 11 | namespace Scintilla { 12 | 13 | // Simplified access to high precision timing. 14 | class ElapsedPeriod { 15 | std::chrono::high_resolution_clock::time_point tp; 16 | public: 17 | /// Capture the moment 18 | ElapsedPeriod() noexcept : tp(std::chrono::high_resolution_clock::now()) { 19 | } 20 | /// Return duration as floating point seconds 21 | double Duration(bool reset=false) { 22 | const std::chrono::high_resolution_clock::time_point tpNow = 23 | std::chrono::high_resolution_clock::now(); 24 | const std::chrono::duration stylingDuration = 25 | std::chrono::duration_cast>(tpNow - tp); 26 | if (reset) { 27 | tp = tpNow; 28 | } 29 | return stylingDuration.count(); 30 | } 31 | }; 32 | 33 | } 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /component/licenses/JScript Panel.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2015-2020 marc2003 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /src/script_interface/MeasureStringInfo.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "MeasureStringInfo.h" 3 | 4 | MeasureStringInfo::MeasureStringInfo(float x, float y, float w, float h, int l, int c) : m_x(x), m_y(y), m_w(w), m_h(h), m_l(l), m_c(c) {} 5 | MeasureStringInfo::~MeasureStringInfo() {} 6 | 7 | STDMETHODIMP MeasureStringInfo::get_chars(int* p) 8 | { 9 | if (!p) return E_POINTER; 10 | 11 | *p = m_c; 12 | return S_OK; 13 | } 14 | 15 | STDMETHODIMP MeasureStringInfo::get_height(float* p) 16 | { 17 | if (!p) return E_POINTER; 18 | 19 | *p = m_h; 20 | return S_OK; 21 | } 22 | 23 | STDMETHODIMP MeasureStringInfo::get_lines(int* p) 24 | { 25 | if (!p) return E_POINTER; 26 | 27 | *p = m_l; 28 | return S_OK; 29 | } 30 | 31 | STDMETHODIMP MeasureStringInfo::get_width(float* p) 32 | { 33 | if (!p) return E_POINTER; 34 | 35 | *p = m_w; 36 | return S_OK; 37 | } 38 | 39 | STDMETHODIMP MeasureStringInfo::get_x(float* p) 40 | { 41 | if (!p) return E_POINTER; 42 | 43 | *p = m_x; 44 | return S_OK; 45 | } 46 | 47 | STDMETHODIMP MeasureStringInfo::get_y(float* p) 48 | { 49 | if (!p) return E_POINTER; 50 | 51 | *p = m_y; 52 | return S_OK; 53 | } 54 | -------------------------------------------------------------------------------- /src/callback_data.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | template 4 | struct callback_data : public pfc::refcounted_object_root 5 | { 6 | callback_data(const T1& p_item1) : m_item1(p_item1) {} 7 | callback_data(const T1& p_item1, const T2& p_item2) : m_item1(p_item1), m_item2(p_item2) {} 8 | callback_data(const T1& p_item1, const T2& p_item2, const T3& p_item3) : m_item1(p_item1), m_item2(p_item2), m_item3(p_item3) {} 9 | 10 | T1 m_item1; 11 | T2 m_item2; 12 | T3 m_item3; 13 | }; 14 | 15 | struct metadb_callback_data : public pfc::refcounted_object_root 16 | { 17 | metadb_callback_data(metadb_handle_list_cref p_items) : m_items(p_items) {} 18 | 19 | metadb_handle_list m_items; 20 | }; 21 | 22 | template 23 | class callback_data_scope_releaser 24 | { 25 | public: 26 | template 27 | callback_data_scope_releaser(TParam p_data) 28 | { 29 | m_data = reinterpret_cast(p_data); 30 | } 31 | 32 | ~callback_data_scope_releaser() 33 | { 34 | m_data->refcount_release(); 35 | } 36 | 37 | T* operator->() 38 | { 39 | return m_data; 40 | } 41 | 42 | private: 43 | T* m_data; 44 | }; 45 | -------------------------------------------------------------------------------- /component/licenses/StackBlur.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010 Mario Klingemann 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /component/licenses/JSON for Modern C++.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2013-2017 Niels Lohmann 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /scintilla/win32/ScintRes.rc: -------------------------------------------------------------------------------- 1 | // Resource file for Scintilla 2 | // Copyright 1998-2010 by Neil Hodgson 3 | // The License.txt file describes the conditions under which this software may be distributed. 4 | 5 | #include 6 | 7 | #define VERSION_SCINTILLA "4.2.2" 8 | #define VERSION_WORDS 4, 2, 2, 0 9 | 10 | VS_VERSION_INFO VERSIONINFO 11 | FILEVERSION VERSION_WORDS 12 | PRODUCTVERSION VERSION_WORDS 13 | FILEFLAGSMASK 0x3fL 14 | FILEFLAGS 0 15 | FILEOS VOS_NT_WINDOWS32 16 | FILETYPE VFT_APP 17 | FILESUBTYPE VFT2_UNKNOWN 18 | BEGIN 19 | BLOCK "VarFileInfo" 20 | BEGIN 21 | VALUE "Translation", 0x409, 1200 22 | END 23 | BLOCK "StringFileInfo" 24 | BEGIN 25 | BLOCK "040904b0" 26 | BEGIN 27 | VALUE "CompanyName", "Neil Hodgson neilh@scintilla.org\0" 28 | VALUE "FileDescription", "Scintilla.DLL - a Source Editing Component\0" 29 | VALUE "FileVersion", VERSION_SCINTILLA "\0" 30 | VALUE "InternalName", "Scintilla\0" 31 | VALUE "LegalCopyright", "Copyright 1998-2012 by Neil Hodgson\0" 32 | VALUE "OriginalFilename", "Scintilla.DLL\0" 33 | VALUE "ProductName", "Scintilla\0" 34 | VALUE "ProductVersion", VERSION_SCINTILLA "\0" 35 | END 36 | END 37 | END 38 | -------------------------------------------------------------------------------- /scintilla/src/CaseFolder.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file CaseFolder.h 3 | ** Classes for case folding. 4 | **/ 5 | // Copyright 1998-2013 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef CASEFOLDER_H 9 | #define CASEFOLDER_H 10 | 11 | namespace Scintilla { 12 | 13 | class CaseFolder { 14 | public: 15 | virtual ~CaseFolder(); 16 | virtual size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) = 0; 17 | }; 18 | 19 | class CaseFolderTable : public CaseFolder { 20 | protected: 21 | char mapping[256]; 22 | public: 23 | CaseFolderTable(); 24 | ~CaseFolderTable() override; 25 | size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) override; 26 | void SetTranslation(char ch, char chTranslation); 27 | void StandardASCII() noexcept; 28 | }; 29 | 30 | class ICaseConverter; 31 | 32 | class CaseFolderUnicode : public CaseFolderTable { 33 | ICaseConverter *converter; 34 | public: 35 | CaseFolderUnicode(); 36 | size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) override; 37 | }; 38 | 39 | } 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/script_interface/MetadbHandle.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "script_interface.h" 3 | 4 | class MetadbHandle : public IDisposableImpl4 5 | { 6 | protected: 7 | MetadbHandle(const metadb_handle_ptr& src); 8 | ~MetadbHandle(); 9 | 10 | void FinalRelease() override; 11 | 12 | metadb_handle_ptr m_handle; 13 | 14 | public: 15 | STDMETHODIMP get__ptr(void** pp) override; 16 | STDMETHODIMP ClearStats() override; 17 | STDMETHODIMP Compare(IMetadbHandle* handle, VARIANT_BOOL* p) override; 18 | STDMETHODIMP GetAlbumArt(UINT art_id, VARIANT_BOOL need_stub, VARIANT* p) override; 19 | STDMETHODIMP GetFileInfo(IFileInfo** pp) override; 20 | STDMETHODIMP RefreshStats() override; 21 | STDMETHODIMP SetFirstPlayed(BSTR first_played) override; 22 | STDMETHODIMP SetLastPlayed(BSTR last_played) override; 23 | STDMETHODIMP SetLoved(UINT loved) override; 24 | STDMETHODIMP SetPlaycount(UINT playcount) override; 25 | STDMETHODIMP SetRating(UINT rating) override; 26 | STDMETHODIMP get_FileSize(__int64* p) override; 27 | STDMETHODIMP get_Length(double* p) override; 28 | STDMETHODIMP get_Path(BSTR* p) override; 29 | STDMETHODIMP get_RawPath(BSTR* p) override; 30 | STDMETHODIMP get_SubSong(UINT* p) override; 31 | }; 32 | -------------------------------------------------------------------------------- /component/samples/complete/album art.txt: -------------------------------------------------------------------------------- 1 | // ==PREPROCESSOR== 2 | // @name "Album Art" 3 | // @author "marc2003" 4 | // @import "%fb2k_component_path%samples\complete\js\lodash.min.js" 5 | // @import "%fb2k_component_path%samples\complete\js\helpers.js" 6 | // @import "%fb2k_component_path%samples\complete\js\panel.js" 7 | // @import "%fb2k_component_path%samples\complete\js\albumart.js" 8 | // ==/PREPROCESSOR== 9 | 10 | var panel = new _.panel('custom_background'); 11 | var albumart = new _.albumart(0, 0, 0, 0); 12 | 13 | panel.item_focus_change(); 14 | 15 | function on_size() { 16 | panel.size(); 17 | albumart.w = panel.w; 18 | albumart.h = panel.h; 19 | } 20 | 21 | function on_paint(gr) { 22 | panel.paint(gr); 23 | albumart.paint(gr); 24 | } 25 | 26 | function on_metadb_changed() { 27 | albumart.metadb_changed(); 28 | } 29 | 30 | function on_mouse_wheel(s) { 31 | albumart.wheel(s); 32 | } 33 | 34 | function on_mouse_move(x, y) { 35 | albumart.move(x, y); 36 | } 37 | 38 | function on_mouse_lbtn_dblclk(x, y) { 39 | albumart.lbtn_dblclk(x, y); 40 | } 41 | 42 | function on_mouse_rbtn_up(x, y) { 43 | return panel.rbtn_up(x, y, albumart); 44 | } 45 | 46 | function on_key_down(k) { 47 | albumart.key_down(k); 48 | } 49 | -------------------------------------------------------------------------------- /src/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define _WIN32_WINNT _WIN32_WINNT_WINXP 4 | #define WINVER _WIN32_WINNT_WINXP 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #include 17 | using json = nlohmann::json; 18 | 19 | #include 20 | #include 21 | 22 | #define NOMINMAX 23 | namespace Gdiplus 24 | { 25 | using std::min; 26 | using std::max; 27 | }; 28 | 29 | #include "resource.h" 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | #include 40 | #include 41 | #include 42 | 43 | #include "foo_jscript_panel.h" 44 | #include "callback_id.h" 45 | #include "guids.h" 46 | 47 | using namespace pfc::stringcvt; 48 | using str_vec = std::vector; 49 | -------------------------------------------------------------------------------- /component/samples/complete/thumbs.txt: -------------------------------------------------------------------------------- 1 | // ==PREPROCESSOR== 2 | // @name "Thumbs" 3 | // @author "marc2003" 4 | // @import "%fb2k_component_path%samples\complete\js\lodash.min.js" 5 | // @import "%fb2k_component_path%samples\complete\js\helpers.js" 6 | // @import "%fb2k_component_path%samples\complete\js\panel.js" 7 | // @import "%fb2k_component_path%samples\complete\js\thumbs.js" 8 | // ==/PREPROCESSOR== 9 | 10 | var panel = new _.panel('custom_background'); 11 | var thumbs = new _.thumbs(); 12 | 13 | panel.item_focus_change(); 14 | 15 | function on_size() { 16 | panel.size(); 17 | thumbs.size(); 18 | } 19 | 20 | function on_paint(gr) { 21 | panel.paint(gr); 22 | thumbs.paint(gr); 23 | } 24 | 25 | function on_metadb_changed() { 26 | thumbs.metadb_changed(); 27 | } 28 | 29 | function on_mouse_wheel(s) { 30 | thumbs.wheel(s); 31 | } 32 | 33 | function on_mouse_move(x, y) { 34 | thumbs.move(x, y); 35 | } 36 | 37 | function on_mouse_lbtn_up(x, y) { 38 | thumbs.lbtn_up(x, y); 39 | } 40 | 41 | function on_mouse_lbtn_dblclk(x, y) { 42 | thumbs.lbtn_dblclk(x, y); 43 | } 44 | 45 | function on_key_down(k) { 46 | thumbs.key_down(k); 47 | } 48 | 49 | function on_mouse_rbtn_up(x, y) { 50 | return panel.rbtn_up(x, y, thumbs); 51 | } 52 | -------------------------------------------------------------------------------- /component/samples/basic/GetAlbumArtV2.txt: -------------------------------------------------------------------------------- 1 | // ==PREPROCESSOR== 2 | // @name "GetAlbumArtV2" 3 | // @author "T.P Wang" 4 | // @import "%fb2k_component_path%docs\flags.txt" 5 | // @import "%fb2k_component_path%docs\helpers.txt" 6 | // ==/PREPROCESSOR== 7 | 8 | // Nothing will show until you start playing a new track 9 | 10 | var g_img = null; 11 | var ww = 0, wh = 0; 12 | 13 | function on_paint(gr) { 14 | gr.FillSolidRect(0, 0, ww, wh, RGB(255, 255, 255)); 15 | if (g_img) { 16 | // Keep aspect ratio 17 | var scale_w = ww / g_img.Width; 18 | var scale_h = wh / g_img.Height; 19 | var scale = Math.min(scale_w, scale_h); 20 | var pos_x = 0, pos_y = 0; 21 | if (scale_w < scale_h) 22 | pos_y = (wh - g_img.height * scale) / 2; 23 | else if (scale_w > scale_h) 24 | pos_x = (ww - g_img.Width * scale) / 2; 25 | gr.DrawImage(g_img, pos_x, pos_y, g_img.Width * scale, g_img.Height * scale, 0, 0, g_img.Width, g_img.Height); 26 | } 27 | } 28 | 29 | function on_size() { 30 | ww = window.Width; 31 | wh = window.Height; 32 | } 33 | 34 | function on_playback_new_track(metadb) { 35 | if (!metadb) 36 | return; 37 | if (g_img) 38 | g_img.Dispose(); 39 | g_img = utils.GetAlbumArtV2(metadb, AlbumArtId.front); 40 | window.Repaint(); 41 | } 42 | -------------------------------------------------------------------------------- /component/samples/basic/StackBlur (image).txt: -------------------------------------------------------------------------------- 1 | // ==PREPROCESSOR== 2 | // @name "StackBlur (image)" 3 | // @author "marc2003" 4 | // @import "%fb2k_component_path%docs\flags.txt" 5 | // @import "%fb2k_component_path%docs\helpers.txt" 6 | // ==/PREPROCESSOR== 7 | 8 | var img = gdi.Image(fb.ComponentPath + 'samples\\basic\\images\\post.jpg'); 9 | var blur_img = null; 10 | var font = gdi.Font('Segoe UI', 16, 1); 11 | var radius = 20; 12 | 13 | StackBlur(radius); 14 | 15 | function StackBlur(radius) { 16 | blur_img && blur_img.Dispose(); 17 | blur_img = img.Clone(0, 0, img.Width, img.Height); 18 | blur_img.StackBlur(radius); 19 | } 20 | 21 | function on_paint(gr) { 22 | gr.DrawImage(blur_img, 0, 0, 600, 600, 0, 0, 600, 600); 23 | gr.DrawImage(img, 6, 30, 200, 200, 0, 0, 600, 600); 24 | // RGB function is defined in docs\helpers.txt 25 | gr.FillSolidRect(0, 0, 600, 24, RGB(0, 0, 0)); 26 | // DT_CENTER is defined in docs\flags.txt 27 | gr.GdiDrawText('Scroll mouse to change radius: ' + radius, font, RGB(255, 255, 255), 0, 0, 600, 24, DT_CENTER); 28 | } 29 | 30 | function on_mouse_wheel(step) { 31 | radius += step * 5; 32 | if (radius < 2) 33 | radius = 2; 34 | if (radius > 254) 35 | radius = 254; 36 | StackBlur(radius); 37 | window.Repaint(); 38 | } 39 | -------------------------------------------------------------------------------- /component/samples/basic/StackBlur (text).txt: -------------------------------------------------------------------------------- 1 | // ==PREPROCESSOR== 2 | // @name "StackBlur (text)" 3 | // @author "T.P Wang / marc2003" 4 | // @import "%fb2k_component_path%docs\flags.txt" 5 | // @import "%fb2k_component_path%docs\helpers.txt" 6 | // ==/PREPROCESSOR== 7 | 8 | var ww = 0, wh = 0; 9 | var img_to_blur; 10 | var g_font = gdi.Font('Segoe UI', 32, FontStyle.Bold); 11 | var text_to_draw = '"Stack Blur" Sample'; 12 | 13 | function on_paint(gr) { 14 | img_to_blur && gr.DrawImage(img_to_blur, 0, 0, ww, wh, 0, 0, ww, wh); 15 | gr.SetTextRenderingHint(TextRenderingHint.ClearTypeGridFit); 16 | gr.DrawString(text_to_draw, g_font, RGB(0, 0, 255), 0, 0, ww, wh, StringFormat(StringAlignment.Center, StringAlignment.Center)); 17 | } 18 | 19 | function on_size() { 20 | ww = window.Width; 21 | wh = window.Height; 22 | if (ww <= 0 || wh <= 0) return; 23 | img_to_blur = gdi.CreateImage(ww, wh); 24 | var g = img_to_blur.GetGraphics(); 25 | g.SetTextRenderingHint(TextRenderingHint.AntiAlias); 26 | g.DrawString(text_to_draw, g_font, RGB(0, 0, 255), 0, 0, ww, wh, StringFormat(StringAlignment.Center, StringAlignment.Center)); 27 | img_to_blur.ReleaseGraphics(g); 28 | // Make Stack Blur, radius value can be between 2 and 254 29 | img_to_blur.StackBlur(30); 30 | } 31 | -------------------------------------------------------------------------------- /component/samples/complete/menu button.txt: -------------------------------------------------------------------------------- 1 | // ==PREPROCESSOR== 2 | // @name "Menu Button" 3 | // @author "marc2003" 4 | // @import "%fb2k_component_path%samples\complete\js\lodash.min.js" 5 | // @import "%fb2k_component_path%samples\complete\js\helpers.js" 6 | // @import "%fb2k_component_path%samples\complete\js\panel.js" 7 | // ==/PREPROCESSOR== 8 | 9 | var panel = new _.panel('custom_background'); 10 | var buttons = new _.buttons(); 11 | buttons.buttons.menu = new _.button(0, 0, 36, 36, {normal : 'misc\\foobar2000.png'}, function (x, y, mask) { _.menu(0, 36); }, 'Menu'); 12 | 13 | function on_focus(is_focused) { 14 | if (is_focused) { 15 | plman.SetActivePlaylistContext(); 16 | } 17 | } 18 | 19 | function on_size() { 20 | panel.size(); 21 | } 22 | 23 | function on_paint(gr) { 24 | panel.paint(gr); 25 | buttons.paint(gr); 26 | } 27 | 28 | function on_mouse_move(x, y) { 29 | buttons.move(x, y); 30 | } 31 | 32 | function on_mouse_leave() { 33 | buttons.leave(); 34 | } 35 | 36 | function on_mouse_lbtn_up(x, y, mask) { 37 | buttons.lbtn_up(x, y, mask); 38 | } 39 | 40 | function on_mouse_rbtn_up(x, y) { 41 | if (buttons.buttons.menu.trace(x, y)) { 42 | _.help(0, 36); 43 | return true; 44 | } else { 45 | return panel.rbtn_up(x, y); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /scintilla/lexlib/LexerNoExceptions.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file LexerNoExceptions.h 3 | ** A simple lexer with no state. 4 | **/ 5 | // Copyright 1998-2010 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef LEXERNOEXCEPTIONS_H 9 | #define LEXERNOEXCEPTIONS_H 10 | 11 | namespace Scintilla { 12 | 13 | // A simple lexer with no state 14 | class LexerNoExceptions : public LexerBase { 15 | public: 16 | // TODO Also need to prevent exceptions in constructor and destructor 17 | Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override; 18 | Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override; 19 | void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) override; 20 | void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *) override; 21 | 22 | virtual void Lexer(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess, Accessor &styler) = 0; 23 | virtual void Folder(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess, Accessor &styler) = 0; 24 | }; 25 | 26 | } 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /component/samples/complete/seekbar.txt: -------------------------------------------------------------------------------- 1 | // ==PREPROCESSOR== 2 | // @name "Seekbar" 3 | // @author "marc2003" 4 | // @import "%fb2k_component_path%samples\complete\js\lodash.min.js" 5 | // @import "%fb2k_component_path%samples\complete\js\helpers.js" 6 | // @import "%fb2k_component_path%samples\complete\js\seekbar.js" 7 | // ==/PREPROCESSOR== 8 | 9 | var seekbar = new _.seekbar(0, 0, 0, 0); 10 | seekbar.c1 = _.RGB(50, 50, 50); 11 | seekbar.c2 = _.RGB(196, 30, 35); 12 | 13 | function on_size() { 14 | seekbar.w = window.Width; 15 | seekbar.h = window.Height; 16 | } 17 | 18 | function on_paint(gr) { 19 | gr.FillSolidRect(seekbar.x, seekbar.y, seekbar.w, seekbar.h, seekbar.c1); 20 | if (fb.IsPlaying && fb.PlaybackLength > 0) { 21 | gr.FillSolidRect(seekbar.x, seekbar.y, seekbar.pos(), seekbar.h, seekbar.c2); 22 | } 23 | } 24 | 25 | function on_playback_seek() { 26 | seekbar.playback_seek(); 27 | } 28 | 29 | function on_playback_stop() { 30 | seekbar.playback_stop(); 31 | } 32 | 33 | function on_mouse_wheel(s) { 34 | seekbar.wheel(s); 35 | } 36 | 37 | function on_mouse_move(x, y) { 38 | seekbar.move(x, y); 39 | } 40 | 41 | function on_mouse_lbtn_down(x, y) { 42 | seekbar.lbtn_down(x, y); 43 | } 44 | 45 | function on_mouse_lbtn_up(x, y) { 46 | seekbar.lbtn_up(x, y); 47 | } 48 | -------------------------------------------------------------------------------- /src/ui/ui_property.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "panel_window.h" 3 | #include "property_ctrl.h" 4 | 5 | class CDialogProperty : public CDialogImpl 6 | { 7 | public: 8 | CDialogProperty(panel_window* p_parent); 9 | 10 | BEGIN_MSG_MAP_EX(CDialogProperty) 11 | CHAIN_MSG_MAP_MEMBER(m_resizer) 12 | MSG_WM_INITDIALOG(OnInitDialog) 13 | COMMAND_RANGE_HANDLER_EX(IDOK, IDCANCEL, OnCloseCmd) 14 | COMMAND_ID_HANDLER_EX(IDC_BTN_APPLY, OnCloseCmd) 15 | COMMAND_HANDLER_EX(IDC_BTN_CLEAR, BN_CLICKED, OnClearBnClicked) 16 | COMMAND_HANDLER_EX(IDC_BTN_EXPORT, BN_CLICKED, OnExportBnClicked) 17 | COMMAND_HANDLER_EX(IDC_BTN_IMPORT, BN_CLICKED, OnImportBnClicked) 18 | END_MSG_MAP() 19 | 20 | enum { IDD = IDD_DIALOG_PROPERTY }; 21 | 22 | BOOL OnInitDialog(CWindow, LPARAM); 23 | void Apply(); 24 | void LoadProperties(bool reload = true); 25 | void OnClearBnClicked(UINT, int, CWindow); 26 | void OnCloseCmd(UINT, int nid, CWindow); 27 | void OnExportBnClicked(UINT, int, CWindow); 28 | void OnImportBnClicked(UINT, int, CWindow); 29 | 30 | private: 31 | CButton m_clear_btn, m_export_btn; 32 | CDialogResizeHelper m_resizer; 33 | MyCList m_properties; 34 | panel_window* m_parent; 35 | pfc::string8_fast m_caption; 36 | panel_properties::property_map m_dup_prop_map; 37 | }; 38 | -------------------------------------------------------------------------------- /component/samples/basic/Timer.txt: -------------------------------------------------------------------------------- 1 | // ==PREPROCESSOR== 2 | // @name "Timer" 3 | // @author "T.P Wang" 4 | // ==/PREPROCESSOR== 5 | 6 | // This sample create two timers 7 | // Click the window to start the timer, and see the result after the console is shown. 8 | // Click the window again to kill all timers. 9 | 10 | var g_timer_started = false; 11 | var g_count = 0; 12 | var g_timer1_ID, g_timer2_ID; 13 | 14 | function print_to_console(msg) { 15 | console.log('Timer test:', msg); 16 | } 17 | 18 | function on_mouse_lbtn_up() { 19 | if (!g_timer_started) { 20 | // Timer are created here 21 | // 2s - one shot, happens after 2000 ms, only once 22 | g_timer1_ID = window.SetTimeout(function() { 23 | // Print and show console 24 | fb.ShowConsole(); 25 | print_to_console('g_timer1: Show console now.'); 26 | }, 2000); 27 | 28 | // 500ms - periodic, happens every 500 ms 29 | g_timer2_ID = window.SetInterval(function() { 30 | g_count++; 31 | print_to_console('g_timer2: ' + g_count + ' time(s).'); 32 | }, 500); 33 | 34 | g_timer_started = true; 35 | } else { 36 | // Kill all timers 37 | window.ClearTimeout(g_timer2_ID); 38 | window.ClearInterval(g_timer1_ID); 39 | g_timer_started = false; 40 | g_count = 0; 41 | print_to_console('Timers killed.'); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /scintilla/src/DBCS.cxx: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file DBCS.cxx 3 | ** Functions to handle DBCS double byte encodings like Shift-JIS. 4 | **/ 5 | // Copyright 2017 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #include "DBCS.h" 9 | 10 | using namespace Scintilla; 11 | 12 | namespace Scintilla { 13 | 14 | bool DBCSIsLeadByte(int codePage, char ch) noexcept { 15 | // Byte ranges found in Wikipedia articles with relevant search strings in each case 16 | const unsigned char uch = ch; 17 | switch (codePage) { 18 | case 932: 19 | // Shift_jis 20 | return ((uch >= 0x81) && (uch <= 0x9F)) || 21 | ((uch >= 0xE0) && (uch <= 0xFC)); 22 | // Lead bytes F0 to FC may be a Microsoft addition. 23 | case 936: 24 | // GBK 25 | return (uch >= 0x81) && (uch <= 0xFE); 26 | case 949: 27 | // Korean Wansung KS C-5601-1987 28 | return (uch >= 0x81) && (uch <= 0xFE); 29 | case 950: 30 | // Big5 31 | return (uch >= 0x81) && (uch <= 0xFE); 32 | case 1361: 33 | // Korean Johab KS C-5601-1992 34 | return 35 | ((uch >= 0x84) && (uch <= 0xD3)) || 36 | ((uch >= 0xD8) && (uch <= 0xDE)) || 37 | ((uch >= 0xE0) && (uch <= 0xF9)); 38 | } 39 | return false; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/script_interface/Tooltip.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "script_interface.h" 3 | 4 | struct panel_tooltip_param 5 | { 6 | panel_tooltip_param() : font_name(nullptr), tooltip_hwnd(nullptr), font_size(0.f), font_style(0) {} 7 | 8 | BSTR font_name; 9 | CWindow tooltip_hwnd; 10 | float font_size; 11 | int font_style; 12 | }; 13 | 14 | using panel_tooltip_param_ptr = std::shared_ptr; 15 | 16 | class Tooltip : public IDisposableImpl4 17 | { 18 | protected: 19 | Tooltip(CWindow p_wndparent, const panel_tooltip_param_ptr& p_param_ptr); 20 | ~Tooltip(); 21 | 22 | void FinalRelease() override; 23 | 24 | BSTR m_tip_buffer; 25 | CWindow m_wndparent = nullptr; 26 | CWindow m_wndtooltip = nullptr; 27 | TOOLINFO m_ti; 28 | panel_tooltip_param_ptr m_panel_tooltip_param_ptr; 29 | 30 | public: 31 | STDMETHODIMP Activate() override; 32 | STDMETHODIMP Deactivate() override; 33 | STDMETHODIMP GetDelayTime(int type, int* p) override; 34 | STDMETHODIMP SetDelayTime(int type, int time) override; 35 | STDMETHODIMP SetMaxWidth(int width) override; 36 | STDMETHODIMP TrackPosition(int x, int y) override; 37 | STDMETHODIMP get_Text(BSTR* p) override; 38 | STDMETHODIMP put_Text(BSTR text) override; 39 | STDMETHODIMP put_TrackActivate(VARIANT_BOOL activate) override; 40 | }; 41 | -------------------------------------------------------------------------------- /component/samples/complete/autoplaylists.txt: -------------------------------------------------------------------------------- 1 | // ==PREPROCESSOR== 2 | // @name "Autoplaylists" 3 | // @author "marc2003" 4 | // @import "%fb2k_component_path%samples\complete\js\lodash.min.js" 5 | // @import "%fb2k_component_path%samples\complete\js\helpers.js" 6 | // @import "%fb2k_component_path%samples\complete\js\panel.js" 7 | // @import "%fb2k_component_path%samples\complete\js\list.js" 8 | // ==/PREPROCESSOR== 9 | 10 | var panel = new _.panel(); 11 | var list = new _.list('autoplaylists', LM, TM, 0, 0); 12 | 13 | function on_size() { 14 | panel.size(); 15 | list.w = panel.w - (LM * 2); 16 | list.h = panel.h - TM; 17 | list.size(); 18 | } 19 | 20 | function on_paint(gr) { 21 | panel.paint(gr); 22 | gr.GdiDrawText(list.header_text(), panel.fonts.title, panel.colours.highlight, LM, 0, panel.w - (LM * 2), TM, LEFT); 23 | gr.DrawLine(list.x, list.y + 1, list.x + list.w, list.y + 1, 1, panel.colours.highlight); 24 | list.paint(gr); 25 | } 26 | 27 | function on_mouse_wheel(s) { 28 | list.wheel(s); 29 | } 30 | 31 | function on_mouse_move(x, y) { 32 | list.move(x, y); 33 | } 34 | 35 | function on_mouse_lbtn_up(x, y) { 36 | list.lbtn_up(x, y); 37 | } 38 | 39 | function on_key_down(k) { 40 | list.key_down(k); 41 | } 42 | 43 | function on_mouse_rbtn_up(x, y) { 44 | return panel.rbtn_up(x, y, list); 45 | } 46 | -------------------------------------------------------------------------------- /src/thread_pool.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class simple_thread_task 4 | { 5 | public: 6 | virtual void run() = 0; 7 | }; 8 | 9 | class simple_thread_worker : public pfc::thread 10 | { 11 | public: 12 | simple_thread_worker(); 13 | virtual ~simple_thread_worker(); 14 | 15 | void threadProc() override; 16 | 17 | private: 18 | PFC_CLASS_NOT_COPYABLE_EX(simple_thread_worker) 19 | }; 20 | 21 | class simple_thread_pool 22 | { 23 | public: 24 | simple_thread_pool(); 25 | ~simple_thread_pool(); 26 | 27 | static simple_thread_pool& instance(); 28 | 29 | bool enqueue(simple_thread_task* task); 30 | bool is_queue_empty(); 31 | simple_thread_task* acquire_task(); 32 | void exit(); 33 | void track(simple_thread_task* task); 34 | void untrack(simple_thread_task* task); 35 | void untrack_all(); 36 | 37 | private: 38 | void add_worker_(simple_thread_worker* worker); 39 | void remove_worker_(simple_thread_worker* worker); 40 | 41 | using t_task_list = pfc::chain_list_v2_t; 42 | 43 | static simple_thread_pool instance_; 44 | 45 | HANDLE empty_worker_; 46 | HANDLE exiting_; 47 | HANDLE have_task_; 48 | critical_section cs_; 49 | t_task_list task_list_; 50 | volatile LONG num_workers_; 51 | 52 | friend class simple_thread_worker; 53 | 54 | PFC_CLASS_NOT_COPYABLE_EX(simple_thread_pool) 55 | }; 56 | -------------------------------------------------------------------------------- /scintilla/lexlib/CharacterSet.cxx: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file CharacterSet.cxx 3 | ** Simple case functions for ASCII. 4 | ** Lexer infrastructure. 5 | **/ 6 | // Copyright 1998-2010 by Neil Hodgson 7 | // The License.txt file describes the conditions under which this software may be distributed. 8 | 9 | #include 10 | #include 11 | 12 | #include "CharacterSet.h" 13 | 14 | using namespace Scintilla; 15 | 16 | namespace Scintilla { 17 | 18 | int CompareCaseInsensitive(const char *a, const char *b) { 19 | while (*a && *b) { 20 | if (*a != *b) { 21 | const char upperA = MakeUpperCase(*a); 22 | const char upperB = MakeUpperCase(*b); 23 | if (upperA != upperB) 24 | return upperA - upperB; 25 | } 26 | a++; 27 | b++; 28 | } 29 | // Either *a or *b is nul 30 | return *a - *b; 31 | } 32 | 33 | int CompareNCaseInsensitive(const char *a, const char *b, size_t len) { 34 | while (*a && *b && len) { 35 | if (*a != *b) { 36 | const char upperA = MakeUpperCase(*a); 37 | const char upperB = MakeUpperCase(*b); 38 | if (upperA != upperB) 39 | return upperA - upperB; 40 | } 41 | a++; 42 | b++; 43 | len--; 44 | } 45 | if (len == 0) 46 | return 0; 47 | else 48 | // Either *a or *b is nul 49 | return *a - *b; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/foo_jscript_panel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace jsp 4 | { 5 | static constexpr const char* component_name = "JScript Panel"; 6 | static constexpr const char* component_version = "2.3.6.1"; 7 | static constexpr const char* component_dll_name = "foo_jscript_panel.dll"; 8 | static constexpr const char* component_info = "Copyright (C) 2015-2020 marc2003\nBased on WSH Panel Mod by T.P. Wang\nThanks for the contributions by TheQwertiest and MordredKLB\n\nBuild: " __TIME__ ", " __DATE__ "\nColumns UI SDK Version: " UI_EXTENSION_VERSION; 9 | static constexpr size_t uwm_refreshbk = WM_USER + 1; 10 | static constexpr size_t uwm_timer = WM_USER + 2; 11 | static constexpr size_t uwm_unload = WM_USER + 3; 12 | static constexpr size_t version = 2360; 13 | static const wchar_t* class_name_dui = L"jsp_class_dui"; 14 | static const wchar_t* class_name_cui = L"jsp_class_cui"; 15 | } 16 | 17 | #define TO_VARIANT_BOOL(v) (v ? VARIANT_TRUE : VARIANT_FALSE) 18 | #define TO_BSTR(str) SysAllocString(string_wide_from_utf8_fast(str)) 19 | #define TO_INT(num) (num == SIZE_MAX ? -1 : static_cast(num)) /* Only use on fb2k API methods that use SIZE_MAX / pfc_infinite to indicate failure. */ 20 | #define TO_UINT(num) static_cast(num) 21 | 22 | #define GET_PTR(X, Y) \ 23 | X->get__ptr(reinterpret_cast(&Y)); \ 24 | if (!Y) return E_INVALIDARG; 25 | -------------------------------------------------------------------------------- /component/samples/basic/Menu Sample.txt: -------------------------------------------------------------------------------- 1 | // ==PREPROCESSOR== 2 | // @name "Menu Sample" 3 | // @author "T.P Wang / marc2003" 4 | // @import "%fb2k_component_path%docs\flags.txt" 5 | // ==/PREPROCESSOR== 6 | 7 | function on_mouse_lbtn_down(x, y) { 8 | var _context = fb.CreateContextMenuManager(); 9 | var _basemenu = window.CreatePopupMenu(); 10 | var _child = window.CreatePopupMenu(); 11 | var idx; 12 | 13 | // start index at 1, NOT 0 14 | _basemenu.AppendMenuItem(MF_STRING, 1, 'item1'); 15 | _basemenu.AppendMenuItem(MF_STRING, 2, 'item2'); 16 | _child.AppendTo(_basemenu, MF_STRING, 'Now Playing'); 17 | 18 | _context.InitNowPlaying(); 19 | _context.BuildMenu(_child, 3); 20 | /* 21 | base_id set to 3 so it won't conflict with manually added items above. 22 | max_id was made optional in v2.0.4 and is omitted in this example. 23 | */ 24 | 25 | idx = _basemenu.TrackPopupMenu(x, y); 26 | 27 | switch (idx) { 28 | case 0: //user dismissed menu by clicking elsewhere. that's why you can't use 0 when building menu items 29 | break; 30 | case 1: 31 | fb.ShowPopupMessage('You have chose item1.'); 32 | break; 33 | case 2: 34 | fb.ShowPopupMessage('OK, item2 is clicked.'); 35 | break; 36 | default: 37 | _context.ExecuteByID(idx - 3); 38 | break; 39 | } 40 | _basemenu.Dispose(); 41 | _child.Dispose(); 42 | _context.Dispose(); 43 | } 44 | -------------------------------------------------------------------------------- /component/samples/complete/queue viewer.txt: -------------------------------------------------------------------------------- 1 | // ==PREPROCESSOR== 2 | // @name "Queue Viewer" 3 | // @author "marc2003" 4 | // @import "%fb2k_component_path%samples\complete\js\lodash.min.js" 5 | // @import "%fb2k_component_path%samples\complete\js\helpers.js" 6 | // @import "%fb2k_component_path%samples\complete\js\panel.js" 7 | // @import "%fb2k_component_path%samples\complete\js\list.js" 8 | // ==/PREPROCESSOR== 9 | 10 | var panel = new _.panel(); 11 | var list = new _.list('queue_viewer', LM, TM, 0, 0); 12 | 13 | function on_playback_queue_changed() { 14 | list.playback_queue_changed(); 15 | } 16 | 17 | function on_size() { 18 | panel.size(); 19 | list.w = panel.w - (LM * 2); 20 | list.h = panel.h - TM; 21 | list.size(); 22 | } 23 | 24 | function on_paint(gr) { 25 | panel.paint(gr); 26 | gr.GdiDrawText(list.header_text(), panel.fonts.title, panel.colours.highlight, LM, 0, panel.w - (LM * 2), TM, LEFT); 27 | gr.DrawLine(list.x, list.y + 1, list.x + list.w, list.y + 1, 1, panel.colours.highlight); 28 | list.paint(gr); 29 | } 30 | 31 | function on_mouse_wheel(s) { 32 | list.wheel(s); 33 | } 34 | 35 | function on_mouse_move(x, y) { 36 | list.move(x, y); 37 | } 38 | 39 | function on_mouse_lbtn_up(x, y) { 40 | list.lbtn_up(x, y); 41 | } 42 | 43 | function on_key_down(k) { 44 | list.key_down(k); 45 | } 46 | 47 | function on_mouse_rbtn_up(x, y) { 48 | return panel.rbtn_up(x, y, list); 49 | } 50 | -------------------------------------------------------------------------------- /component/samples/complete/text reader.txt: -------------------------------------------------------------------------------- 1 | // ==PREPROCESSOR== 2 | // @name "Text Reader" 3 | // @author "marc2003" 4 | // @import "%fb2k_component_path%samples\complete\js\lodash.min.js" 5 | // @import "%fb2k_component_path%samples\complete\js\helpers.js" 6 | // @import "%fb2k_component_path%samples\complete\js\panel.js" 7 | // @import "%fb2k_component_path%samples\complete\js\text.js" 8 | // ==/PREPROCESSOR== 9 | 10 | var panel = new _.panel(); 11 | var text = new _.text('text_reader', LM, TM, 0, 0); 12 | 13 | panel.item_focus_change(); 14 | 15 | function on_size() { 16 | panel.size(); 17 | text.w = panel.w - (LM * 2); 18 | text.h = panel.h - TM; 19 | text.size(); 20 | } 21 | 22 | function on_paint(gr) { 23 | panel.paint(gr); 24 | gr.GdiDrawText(text.header_text(), panel.fonts.title, panel.colours.highlight, LM, 0, panel.w - (LM * 2), TM, LEFT); 25 | gr.DrawLine(text.x, text.y + 1, text.x + text.w, text.y + 1, 1, panel.colours.highlight); 26 | text.paint(gr); 27 | } 28 | 29 | function on_metadb_changed() { 30 | text.metadb_changed(); 31 | } 32 | 33 | function on_mouse_wheel(s) { 34 | text.wheel(s); 35 | } 36 | 37 | function on_mouse_move(x, y) { 38 | text.move(x, y); 39 | } 40 | 41 | function on_mouse_lbtn_up(x, y) { 42 | text.lbtn_up(x, y); 43 | } 44 | 45 | function on_key_down(k) { 46 | text.key_down(k); 47 | } 48 | 49 | function on_mouse_rbtn_up(x, y) { 50 | return panel.rbtn_up(x, y, text); 51 | } 52 | -------------------------------------------------------------------------------- /component/samples/complete/allmusic review.txt: -------------------------------------------------------------------------------- 1 | // ==PREPROCESSOR== 2 | // @name "Allmusic Review" 3 | // @author "marc2003" 4 | // @import "%fb2k_component_path%samples\complete\js\lodash.min.js" 5 | // @import "%fb2k_component_path%samples\complete\js\helpers.js" 6 | // @import "%fb2k_component_path%samples\complete\js\panel.js" 7 | // @import "%fb2k_component_path%samples\complete\js\text.js" 8 | // ==/PREPROCESSOR== 9 | 10 | var panel = new _.panel(); 11 | var text = new _.text('allmusic', LM, TM, 0, 0); 12 | 13 | panel.item_focus_change(); 14 | 15 | function on_size() { 16 | panel.size(); 17 | text.w = panel.w - (LM * 2); 18 | text.h = panel.h - TM; 19 | text.size(); 20 | } 21 | 22 | function on_paint(gr) { 23 | panel.paint(gr); 24 | gr.GdiDrawText(text.header_text(), panel.fonts.title, panel.colours.highlight, LM, 0, panel.w - (LM * 2), TM, LEFT); 25 | gr.DrawLine(text.x, text.y + 1, text.x + text.w, text.y + 1, 1, panel.colours.highlight); 26 | text.paint(gr); 27 | } 28 | 29 | function on_metadb_changed() { 30 | text.metadb_changed(); 31 | } 32 | 33 | function on_mouse_wheel(s) { 34 | text.wheel(s); 35 | } 36 | 37 | function on_mouse_move(x, y) { 38 | text.move(x, y); 39 | } 40 | 41 | function on_mouse_lbtn_up(x, y) { 42 | text.lbtn_up(x, y); 43 | } 44 | 45 | function on_key_down(k) { 46 | text.key_down(k); 47 | } 48 | 49 | function on_mouse_rbtn_up(x, y) { 50 | return panel.rbtn_up(x, y, text); 51 | } 52 | -------------------------------------------------------------------------------- /component/samples/basic/Volbar with GdiDrawText.txt: -------------------------------------------------------------------------------- 1 | // ==PREPROCESSOR== 2 | // @name "Volbar with GdiDrawText" 3 | // @author "T.P Wang" 4 | // @import "%fb2k_component_path%docs\flags.txt" 5 | // @import "%fb2k_component_path%docs\helpers.txt" 6 | // ==/PREPROCESSOR== 7 | 8 | var g_font = gdi.Font('Segoe UI', 12, 0); 9 | var g_drag = 0; 10 | var ww = 0, wh = 0; 11 | 12 | function on_size() { 13 | ww = window.Width; 14 | wh = window.Height; 15 | } 16 | 17 | function on_paint(gr) { 18 | var volume = fb.Volume; 19 | var pos = ww * vol2pos(volume); 20 | var txt = volume.toFixed(2) + 'dB'; 21 | gr.FillGradRect(0, 0, pos, wh, 90, RGB(240, 240, 240), RGB(100, 230, 100)); 22 | gr.FillGradRect(pos, 0, ww - pos, wh, 90, RGB(240, 240, 240), RGB(190, 190, 190)); 23 | gr.GdiDrawText(txt, g_font, RGB(64, 64, 128), 0, 0, ww, wh, DT_CENTER | DT_VCENTER | DT_SINGLELINE); 24 | gr.DrawRect(0, 0, ww - 1, wh - 1, 1.0, RGB(150, 150, 150)); 25 | } 26 | 27 | function on_mouse_lbtn_down(x, y) { 28 | g_drag = 1; 29 | } 30 | 31 | function on_mouse_lbtn_up(x, y) { 32 | on_mouse_move(x, y); 33 | g_drag = 0; 34 | } 35 | 36 | function on_mouse_move(x, y) { 37 | if (g_drag) { 38 | var pos = x < 0 ? 0 : x > ww ? 1 : x / ww; 39 | fb.Volume = pos2vol(pos); 40 | } 41 | } 42 | 43 | function on_mouse_wheel(delta) { 44 | if (delta > 0) 45 | fb.VolumeUp(); 46 | else 47 | fb.VolumeDown(); 48 | } 49 | 50 | function on_volume_change(val) { 51 | window.Repaint(); 52 | } 53 | -------------------------------------------------------------------------------- /src/script_interface/PlaybackQueueItem.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "PlaybackQueueItem.h" 3 | 4 | PlaybackQueueItem::PlaybackQueueItem() {} 5 | 6 | PlaybackQueueItem::PlaybackQueueItem(const t_playback_queue_item& playbackQueueItem) 7 | { 8 | m_playback_queue_item.m_handle = playbackQueueItem.m_handle; 9 | m_playback_queue_item.m_playlist = playbackQueueItem.m_playlist; 10 | m_playback_queue_item.m_item = playbackQueueItem.m_item; 11 | } 12 | 13 | PlaybackQueueItem::~PlaybackQueueItem() {} 14 | 15 | void PlaybackQueueItem::FinalRelease() 16 | { 17 | m_playback_queue_item.m_handle.release(); 18 | m_playback_queue_item.m_playlist = 0; 19 | m_playback_queue_item.m_item = 0; 20 | } 21 | 22 | STDMETHODIMP PlaybackQueueItem::get__ptr(void** pp) 23 | { 24 | if (!pp) return E_POINTER; 25 | 26 | *pp = &m_playback_queue_item; 27 | return S_OK; 28 | } 29 | 30 | STDMETHODIMP PlaybackQueueItem::get_Handle(IMetadbHandle** pp) 31 | { 32 | if (!pp) return E_POINTER; 33 | 34 | *pp = new com_object_impl_t(m_playback_queue_item.m_handle); 35 | return S_OK; 36 | } 37 | 38 | STDMETHODIMP PlaybackQueueItem::get_PlaylistIndex(int* p) 39 | { 40 | if (!p) return E_POINTER; 41 | 42 | *p = TO_INT(m_playback_queue_item.m_playlist); 43 | return S_OK; 44 | } 45 | 46 | STDMETHODIMP PlaybackQueueItem::get_PlaylistItemIndex(int* p) 47 | { 48 | if (!p) return E_POINTER; 49 | 50 | *p = TO_INT(m_playback_queue_item.m_item); 51 | return S_OK; 52 | } 53 | -------------------------------------------------------------------------------- /src/script_info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct script_info 4 | { 5 | script_info() {} 6 | 7 | const std::vector> expand_table = 8 | { 9 | { "%fb2k_profile_path%", helpers::get_profile_path().get_ptr() }, 10 | { "%fb2k_component_path%", helpers::get_fb2k_component_path().get_ptr() }, 11 | { "%fb2k_path%", helpers::get_fb2k_path().get_ptr() }, 12 | }; 13 | 14 | pfc::string8_fast build_info_string() const 15 | { 16 | pfc::string8_fast ret; 17 | ret << jsp::component_name << " v" << jsp::component_version << " ("; 18 | if (name.length()) 19 | { 20 | ret << name.c_str(); 21 | } 22 | else 23 | { 24 | ret << "id:" << id; 25 | } 26 | if (version.length()) 27 | { 28 | ret << " v" << version.c_str(); 29 | } 30 | if (author.length()) 31 | { 32 | ret << " by " << author.c_str(); 33 | } 34 | ret << ")"; 35 | return ret; 36 | } 37 | 38 | std::string expand_import(size_t idx) 39 | { 40 | std::string tmp = imports[idx]; 41 | for (const auto& [key, value] : expand_table) 42 | { 43 | if (tmp.find(key) == 0) 44 | { 45 | tmp = value + tmp.substr(key.length()); 46 | break; 47 | } 48 | } 49 | return tmp; 50 | } 51 | 52 | void clear() 53 | { 54 | imports.clear(); 55 | name = ""; 56 | version = ""; 57 | author = ""; 58 | id = 0; 59 | } 60 | 61 | size_t id = 0; 62 | std::string name; 63 | std::string version; 64 | std::string author; 65 | str_vec imports; 66 | }; 67 | -------------------------------------------------------------------------------- /component/licenses/foobar2000 SDK.txt: -------------------------------------------------------------------------------- 1 | foobar2000 1.5 SDK 2 | Copyright (c) 2001-2019, Peter Pawlowski 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | 7 | Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 9 | 10 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 11 | 12 | Note that separate less restrictive licenses apply to the included 'pfc' and 'libPPUI' libraries. See license files included in respective folders for details. 13 | -------------------------------------------------------------------------------- /component/samples/complete/rating.txt: -------------------------------------------------------------------------------- 1 | // ==PREPROCESSOR== 2 | // @name "Rating" 3 | // @author "marc2003" 4 | // @import "%fb2k_component_path%samples\complete\js\lodash.min.js" 5 | // @import "%fb2k_component_path%samples\complete\js\helpers.js" 6 | // @import "%fb2k_component_path%samples\complete\js\panel.js" 7 | // @import "%fb2k_component_path%samples\complete\js\rating.js" 8 | // ==/PREPROCESSOR== 9 | 10 | /* 11 | Now supports 3 modes: 12 | 1) foo_playcount, limited to 5 stars, access via %rating% 13 | 2) file tags, configurable max limit, access via custom tag. Use right click menu to set. 14 | 3) JScript Panel "Playback stats" database, configurable max limit, access via %jsp_rating%. Bound to "%artist% - %title%" so common tracks across different albums will share the rating. 15 | */ 16 | 17 | var panel = new _.panel('custom_background'); 18 | var rating = new _.rating(0, 0, 24, _.RGB(255, 128, 0)); // x, y, height, colour 19 | 20 | panel.item_focus_change(); 21 | 22 | function on_size() { 23 | panel.size(); 24 | } 25 | 26 | function on_paint(gr) { 27 | panel.paint(gr); 28 | rating.paint(gr); 29 | } 30 | 31 | function on_metadb_changed() { 32 | rating.metadb_changed(); 33 | } 34 | 35 | function on_mouse_move(x, y) { 36 | rating.move(x, y); 37 | } 38 | 39 | function on_mouse_leave() { 40 | rating.leave(); 41 | } 42 | 43 | function on_mouse_lbtn_up(x, y) { 44 | rating.lbtn_up(x, y); 45 | } 46 | 47 | function on_mouse_rbtn_up(x, y) { 48 | return panel.rbtn_up(x, y, rating); 49 | } 50 | -------------------------------------------------------------------------------- /src/mainmenu.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "panel_manager.h" 3 | 4 | namespace 5 | { 6 | class my_mainmenu_commands : public mainmenu_commands 7 | { 8 | public: 9 | GUID get_command(size_t p_index) override 10 | { 11 | return jsp::guids::mainmenu_items[p_index]; 12 | } 13 | 14 | GUID get_parent() override 15 | { 16 | return jsp::guids::mainmenu_group_id; 17 | } 18 | 19 | bool get_description(size_t p_index, pfc::string_base& p_out) override 20 | { 21 | p_out = PFC_string_formatter() << "Invoke on_main_menu(" << (p_index + 1) << ")"; 22 | return true; 23 | } 24 | 25 | bool get_display(size_t p_index, pfc::string_base& p_out, size_t& p_flags) override 26 | { 27 | get_name(p_index, p_out); 28 | p_flags = mainmenu_commands::flag_defaulthidden; 29 | return true; 30 | } 31 | 32 | size_t get_command_count() override 33 | { 34 | return jsp::guids::mainmenu_items.size(); 35 | } 36 | 37 | void execute(size_t p_index, service_ptr_t p_callback) override 38 | { 39 | panel_manager::instance().post_msg_to_all(callback_id::on_main_menu, p_index + 1); 40 | } 41 | 42 | void get_name(size_t p_index, pfc::string_base& p_out) override 43 | { 44 | p_out = std::to_string(p_index + 1).c_str(); 45 | } 46 | }; 47 | 48 | static mainmenu_group_popup_factory g_my_mainmenu_group(jsp::guids::mainmenu_group_id, mainmenu_groups::file, mainmenu_commands::sort_priority_base, jsp::component_name); 49 | FB2K_SERVICE_FACTORY(my_mainmenu_commands); 50 | } 51 | -------------------------------------------------------------------------------- /component/samples/complete/last.fm bio.txt: -------------------------------------------------------------------------------- 1 | // ==PREPROCESSOR== 2 | // @name "Last.fm Bio" 3 | // @author "marc2003" 4 | // @import "%fb2k_component_path%samples\complete\js\lodash.min.js" 5 | // @import "%fb2k_component_path%samples\complete\js\helpers.js" 6 | // @import "%fb2k_component_path%samples\complete\js\panel.js" 7 | // @import "%fb2k_component_path%samples\complete\js\lastfm.js" 8 | // @import "%fb2k_component_path%samples\complete\js\text.js" 9 | // ==/PREPROCESSOR== 10 | 11 | var panel = new _.panel(); 12 | var lastfm = new _.lastfm(); 13 | var text = new _.text('lastfm_bio', LM, TM, 0, 0); 14 | 15 | panel.item_focus_change(); 16 | 17 | function on_size() { 18 | panel.size(); 19 | text.w = panel.w - (LM * 2); 20 | text.h = panel.h - TM; 21 | text.size(); 22 | } 23 | 24 | function on_paint(gr) { 25 | panel.paint(gr); 26 | gr.GdiDrawText(text.header_text(), panel.fonts.title, panel.colours.highlight, LM, 0, panel.w - (LM * 2), TM, LEFT); 27 | gr.DrawLine(text.x, text.y + 1, text.x + text.w, text.y + 1, 1, panel.colours.highlight); 28 | text.paint(gr); 29 | } 30 | 31 | function on_metadb_changed() { 32 | text.metadb_changed(); 33 | } 34 | 35 | function on_mouse_wheel(s) { 36 | text.wheel(s); 37 | } 38 | 39 | function on_mouse_move(x, y) { 40 | text.move(x, y); 41 | } 42 | 43 | function on_mouse_lbtn_up(x, y) { 44 | text.lbtn_up(x, y); 45 | } 46 | 47 | function on_key_down(k) { 48 | text.key_down(k); 49 | } 50 | 51 | function on_mouse_rbtn_up(x, y) { 52 | return panel.rbtn_up(x, y, text); 53 | } 54 | -------------------------------------------------------------------------------- /scintilla/win32/DepGen.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # DepGen.py - produce a make dependencies file for Scintilla 3 | # Copyright 2019 by Neil Hodgson 4 | # The License.txt file describes the conditions under which this software may be distributed. 5 | # Requires Python 2.7 or later 6 | 7 | import sys 8 | 9 | sys.path.append("..") 10 | 11 | from scripts import Dependencies 12 | 13 | topComment = "# Created by DepGen.py. To recreate, run 'python DepGen.py'.\n" 14 | 15 | def Generate(): 16 | sources = ["../src/*.cxx", "../lexlib/*.cxx", "../lexers/*.cxx"] 17 | includes = ["../include", "../src", "../lexlib"] 18 | 19 | # Create the dependencies file for g++ 20 | deps = Dependencies.FindDependencies(["../win32/*.cxx"] + sources, ["../win32"] + includes, ".o", "../win32/") 21 | 22 | # Add ScintillaBaseL as the same as ScintillaBase 23 | deps = Dependencies.InsertSynonym(deps, "ScintillaBase.o", "ScintillaBaseL.o") 24 | 25 | # Add ScintillaWinL as the same as ScintillaWin 26 | deps = Dependencies.InsertSynonym(deps, "ScintillaWin.o", "ScintillaWinL.o") 27 | 28 | Dependencies.UpdateDependencies("../win32/deps.mak", deps, topComment) 29 | 30 | # Create the dependencies file for MSVC 31 | 32 | # Place the objects in $(DIR_O) and change extension from ".o" to ".obj" 33 | deps = [["$(DIR_O)/"+Dependencies.PathStem(obj)+".obj", headers] for obj, headers in deps] 34 | 35 | Dependencies.UpdateDependencies("../win32/nmdeps.mak", deps, topComment) 36 | 37 | if __name__ == "__main__": 38 | Generate() -------------------------------------------------------------------------------- /component/samples/complete/musicbrainz.txt: -------------------------------------------------------------------------------- 1 | // ==PREPROCESSOR== 2 | // @name "Musicbrainz" 3 | // @author "marc2003" 4 | // @import "%fb2k_component_path%samples\complete\js\lodash.min.js" 5 | // @import "%fb2k_component_path%samples\complete\js\helpers.js" 6 | // @import "%fb2k_component_path%samples\complete\js\panel.js" 7 | // @import "%fb2k_component_path%samples\complete\js\list.js" 8 | // ==/PREPROCESSOR== 9 | 10 | // This script requires "musicbrainz_artistid" or "musicbrainz artist id" tags present in your files. 11 | 12 | var panel = new _.panel(); 13 | var list = new _.list('musicbrainz', LM, TM, 0, 0); 14 | 15 | panel.item_focus_change(); 16 | 17 | function on_size() { 18 | panel.size(); 19 | list.w = panel.w - (LM * 2); 20 | list.h = panel.h - TM; 21 | list.size(); 22 | } 23 | 24 | function on_paint(gr) { 25 | panel.paint(gr); 26 | gr.GdiDrawText(list.header_text(), panel.fonts.title, panel.colours.highlight, LM, 0, panel.w - (LM * 2), TM, LEFT); 27 | gr.DrawLine(list.x, list.y + 1, list.x + list.w, list.y + 1, 1, panel.colours.highlight); 28 | list.paint(gr); 29 | } 30 | 31 | function on_metadb_changed() { 32 | list.metadb_changed(); 33 | } 34 | 35 | function on_mouse_wheel(s) { 36 | list.wheel(s); 37 | } 38 | 39 | function on_mouse_move(x, y) { 40 | list.move(x, y); 41 | } 42 | 43 | function on_mouse_lbtn_up(x, y) { 44 | list.lbtn_up(x, y); 45 | } 46 | 47 | function on_key_down(k) { 48 | list.key_down(k); 49 | } 50 | 51 | function on_mouse_rbtn_up(x, y) { 52 | return panel.rbtn_up(x, y, list); 53 | } 54 | -------------------------------------------------------------------------------- /scintilla/lexlib/CharacterCategory.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file CharacterCategory.h 3 | ** Returns the Unicode general category of a character. 4 | **/ 5 | // Copyright 2013 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef CHARACTERCATEGORY_H 9 | #define CHARACTERCATEGORY_H 10 | 11 | namespace Scintilla { 12 | 13 | enum CharacterCategory { 14 | ccLu, ccLl, ccLt, ccLm, ccLo, 15 | ccMn, ccMc, ccMe, 16 | ccNd, ccNl, ccNo, 17 | ccPc, ccPd, ccPs, ccPe, ccPi, ccPf, ccPo, 18 | ccSm, ccSc, ccSk, ccSo, 19 | ccZs, ccZl, ccZp, 20 | ccCc, ccCf, ccCs, ccCo, ccCn 21 | }; 22 | 23 | CharacterCategory CategoriseCharacter(int character); 24 | 25 | // Common definitions of allowable characters in identifiers from UAX #31. 26 | bool IsIdStart(int character); 27 | bool IsIdContinue(int character); 28 | bool IsXidStart(int character); 29 | bool IsXidContinue(int character); 30 | 31 | class CharacterCategoryMap { 32 | private: 33 | std::vector dense; 34 | public: 35 | CharacterCategoryMap(); 36 | CharacterCategory CategoryFor(int character) const { 37 | if (static_cast(character) < dense.size()) { 38 | return static_cast(dense[character]); 39 | } else { 40 | // binary search through ranges 41 | return CategoriseCharacter(character); 42 | } 43 | } 44 | int Size() const noexcept; 45 | void Optimize(int countCharacters); 46 | }; 47 | 48 | } 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/script_interface/GdiFont.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "GdiFont.h" 3 | 4 | GdiFont::GdiFont(Gdiplus::Font* p, HFONT hFont, bool managed) : GdiObj(p), m_hFont(hFont), m_managed(managed) {} 5 | GdiFont::~GdiFont() {} 6 | 7 | void GdiFont::FinalRelease() 8 | { 9 | if (m_hFont && m_managed) 10 | { 11 | DeleteFont(m_hFont); 12 | m_hFont = nullptr; 13 | } 14 | 15 | GdiObj::FinalRelease(); 16 | } 17 | 18 | STDMETHODIMP GdiFont::get__HFont(UINT* p) 19 | { 20 | if (!m_ptr || !p) return E_POINTER; 21 | 22 | *p = reinterpret_cast(m_hFont); 23 | return S_OK; 24 | } 25 | 26 | STDMETHODIMP GdiFont::get_Height(UINT* p) 27 | { 28 | if (!m_ptr || !p) return E_POINTER; 29 | 30 | Gdiplus::Bitmap img(1, 1, PixelFormat32bppPARGB); 31 | Gdiplus::Graphics g(&img); 32 | *p = TO_UINT(m_ptr->GetHeight(&g)); 33 | return S_OK; 34 | } 35 | 36 | STDMETHODIMP GdiFont::get_Name(BSTR* p) 37 | { 38 | if (!m_ptr || !p) return E_POINTER; 39 | 40 | wchar_t name[LF_FACESIZE] = { 0 }; 41 | Gdiplus::FontFamily fontFamily; 42 | m_ptr->GetFamily(&fontFamily); 43 | fontFamily.GetFamilyName(name, LANG_NEUTRAL); 44 | *p = SysAllocString(name); 45 | return S_OK; 46 | } 47 | 48 | STDMETHODIMP GdiFont::get_Size(float* p) 49 | { 50 | if (!m_ptr || !p) return E_POINTER; 51 | 52 | *p = m_ptr->GetSize(); 53 | return S_OK; 54 | } 55 | 56 | STDMETHODIMP GdiFont::get_Style(int* p) 57 | { 58 | if (!m_ptr || !p) return E_POINTER; 59 | 60 | *p = m_ptr->GetStyle(); 61 | return S_OK; 62 | } 63 | -------------------------------------------------------------------------------- /src/script_interface/ContextMenuManager.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "ContextMenuManager.h" 3 | 4 | ContextMenuManager::ContextMenuManager() {} 5 | ContextMenuManager::~ContextMenuManager() {} 6 | 7 | void ContextMenuManager::FinalRelease() 8 | { 9 | m_cm.release(); 10 | } 11 | 12 | STDMETHODIMP ContextMenuManager::BuildMenu(IMenuObj* p, int base_id) 13 | { 14 | if (m_cm.is_empty()) return E_POINTER; 15 | 16 | HMENU menuid; 17 | p->get__ID(&menuid); 18 | contextmenu_node* parent = m_cm->get_root(); 19 | m_cm->win32_build_menu(menuid, parent, base_id, -1); 20 | return S_OK; 21 | } 22 | 23 | STDMETHODIMP ContextMenuManager::ExecuteByID(UINT id, VARIANT_BOOL* p) 24 | { 25 | if (m_cm.is_empty() || !p) return E_POINTER; 26 | 27 | *p = TO_VARIANT_BOOL(m_cm->execute_by_id(id)); 28 | return S_OK; 29 | } 30 | 31 | STDMETHODIMP ContextMenuManager::InitContext(IMetadbHandleList* handles) 32 | { 33 | metadb_handle_list* handles_ptr = nullptr; 34 | GET_PTR(handles, handles_ptr); 35 | 36 | contextmenu_manager::g_create(m_cm); 37 | m_cm->init_context(*handles_ptr, contextmenu_manager::flag_show_shortcuts); 38 | return S_OK; 39 | } 40 | 41 | STDMETHODIMP ContextMenuManager::InitContextPlaylist() 42 | { 43 | contextmenu_manager::g_create(m_cm); 44 | m_cm->init_context_playlist(contextmenu_manager::flag_show_shortcuts); 45 | return S_OK; 46 | } 47 | 48 | STDMETHODIMP ContextMenuManager::InitNowPlaying() 49 | { 50 | contextmenu_manager::g_create(m_cm); 51 | m_cm->init_context_now_playing(contextmenu_manager::flag_show_shortcuts); 52 | return S_OK; 53 | } 54 | -------------------------------------------------------------------------------- /scintilla/src/UniqueString.cxx: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file UniqueString.cxx 3 | ** Define an allocator for UniqueString. 4 | **/ 5 | // Copyright 2017 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "UniqueString.h" 14 | 15 | namespace Scintilla { 16 | 17 | /// Equivalent to strdup but produces a std::unique_ptr allocation to go 18 | /// into collections. 19 | UniqueString UniqueStringCopy(const char *text) { 20 | if (!text) { 21 | return UniqueString(); 22 | } 23 | const std::string_view sv(text); 24 | std::unique_ptr upcNew = std::make_unique(sv.length() + 1); 25 | sv.copy(upcNew.get(), sv.length()); 26 | return UniqueString(upcNew.release()); 27 | } 28 | 29 | // A set of strings that always returns the same pointer for each string. 30 | 31 | UniqueStringSet::UniqueStringSet() noexcept = default; 32 | 33 | UniqueStringSet::~UniqueStringSet() { 34 | strings.clear(); 35 | } 36 | 37 | void UniqueStringSet::Clear() noexcept { 38 | strings.clear(); 39 | } 40 | 41 | const char *UniqueStringSet::Save(const char *text) { 42 | if (!text) 43 | return nullptr; 44 | 45 | const std::string_view sv(text); 46 | for (const UniqueString &us : strings) { 47 | if (sv == us.get()) { 48 | return us.get(); 49 | } 50 | } 51 | 52 | strings.push_back(UniqueStringCopy(text)); 53 | return strings.back().get(); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /component/samples/basic/GetAlbumArtAsync.txt: -------------------------------------------------------------------------------- 1 | // ==PREPROCESSOR== 2 | // @name "GetAlbumArtAsync" 3 | // @author "T.P Wang" 4 | // @import "%fb2k_component_path%docs\flags.txt" 5 | // @import "%fb2k_component_path%docs\helpers.txt" 6 | // ==/PREPROCESSOR== 7 | 8 | // Nothing will show until you start playing a new track 9 | 10 | var g_img = null; 11 | var path = ""; 12 | var ww = 0, wh = 0; 13 | 14 | function on_paint(gr) { 15 | gr.FillSolidRect(0, 0, ww, wh, RGB(255, 255, 255)); 16 | if (g_img) { 17 | // Keep aspect ratio 18 | var scale_w = ww / g_img.Width; 19 | var scale_h = wh / g_img.Height; 20 | var scale = Math.min(scale_w, scale_h); 21 | var pos_x = 0, pos_y = 0; 22 | if (scale_w < scale_h) 23 | pos_y = (wh - g_img.height * scale) / 2; 24 | else if (scale_w > scale_h) 25 | pos_x = (ww - g_img.Width * scale) / 2; 26 | gr.DrawImage(g_img, pos_x, pos_y, g_img.Width * scale, g_img.Height * scale, 0, 0, g_img.Width, g_img.Height); 27 | } 28 | } 29 | 30 | function on_size() { 31 | ww = window.Width; 32 | wh = window.Height; 33 | } 34 | 35 | function on_playback_new_track(metadb) { 36 | if (!metadb) 37 | return; 38 | if (g_img) 39 | g_img.Dispose(); 40 | utils.GetAlbumArtAsync(window.ID, metadb, AlbumArtId.front); 41 | g_img = null; 42 | path = null; 43 | } 44 | 45 | function on_get_album_art_done(metadb, art_id, image, image_path) { 46 | path = image_path; 47 | g_img = image; 48 | window.Repaint(); 49 | } 50 | 51 | function on_mouse_lbtn_dblclk(x, y) { 52 | //double click panel to show path in popup window 53 | if (path) 54 | fb.ShowPopupMessage(path); 55 | } 56 | -------------------------------------------------------------------------------- /scintilla/src/UniqueString.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file UniqueString.h 3 | ** Define UniqueString, a unique_ptr based string type for storage in containers 4 | ** and an allocator for UniqueString. 5 | ** Define UniqueStringSet which holds a set of strings, used to avoid holding many copies 6 | ** of font names. 7 | **/ 8 | // Copyright 2017 by Neil Hodgson 9 | // The License.txt file describes the conditions under which this software may be distributed. 10 | 11 | #ifndef UNIQUESTRING_H 12 | #define UNIQUESTRING_H 13 | 14 | namespace Scintilla { 15 | 16 | constexpr bool IsNullOrEmpty(const char *text) noexcept { 17 | return text == nullptr || *text == '\0'; 18 | } 19 | 20 | using UniqueString = std::unique_ptr; 21 | 22 | /// Equivalent to strdup but produces a std::unique_ptr allocation to go 23 | /// into collections. 24 | UniqueString UniqueStringCopy(const char *text); 25 | 26 | // A set of strings that always returns the same pointer for each string. 27 | 28 | class UniqueStringSet { 29 | private: 30 | std::vector strings; 31 | public: 32 | UniqueStringSet() noexcept; 33 | // UniqueStringSet objects can not be copied. 34 | UniqueStringSet(const UniqueStringSet &) = delete; 35 | UniqueStringSet &operator=(const UniqueStringSet &) = delete; 36 | // UniqueStringSet objects can be moved. 37 | UniqueStringSet(UniqueStringSet &&) = default; 38 | UniqueStringSet &operator=(UniqueStringSet &&) = default; 39 | ~UniqueStringSet(); 40 | void Clear() noexcept; 41 | const char *Save(const char *text); 42 | }; 43 | 44 | } 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/script_interface/ThemeManager.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "ThemeManager.h" 3 | 4 | ThemeManager::ThemeManager(HWND hwnd, BSTR classlist) 5 | { 6 | m_theme = OpenThemeData(hwnd, classlist); 7 | 8 | if (!m_theme) throw pfc::exception_invalid_params(); 9 | } 10 | 11 | ThemeManager::~ThemeManager() {} 12 | 13 | void ThemeManager::FinalRelease() 14 | { 15 | if (m_theme) 16 | { 17 | CloseThemeData(m_theme); 18 | m_theme = nullptr; 19 | } 20 | } 21 | 22 | STDMETHODIMP ThemeManager::DrawThemeBackground(IGdiGraphics* gr, int x, int y, int w, int h, int clip_x, int clip_y, int clip_w, int clip_h) 23 | { 24 | if (!m_theme) return E_POINTER; 25 | 26 | Gdiplus::Graphics* graphics = nullptr; 27 | GET_PTR(gr, graphics); 28 | 29 | CRect rc(x, y, x + w, y + h); 30 | CRect rc_clip(clip_x, clip_y, clip_x + clip_w, clip_y + clip_h); 31 | LPCRECT rc_pclip = &rc_clip; 32 | HDC dc = graphics->GetHDC(); 33 | 34 | if (clip_x == 0 && clip_y == 0 && clip_w == 0 && clip_h == 0) 35 | { 36 | rc_pclip = nullptr; 37 | } 38 | 39 | const HRESULT hr = ::DrawThemeBackground(m_theme, dc, m_partid, m_stateid, &rc, rc_pclip); 40 | 41 | graphics->ReleaseHDC(dc); 42 | return hr; 43 | } 44 | 45 | STDMETHODIMP ThemeManager::IsThemePartDefined(int partid, int stateid, VARIANT_BOOL* p) 46 | { 47 | if (!m_theme || !p) return E_POINTER; 48 | 49 | *p = TO_VARIANT_BOOL(::IsThemePartDefined(m_theme, partid, stateid)); 50 | return S_OK; 51 | } 52 | 53 | STDMETHODIMP ThemeManager::SetPartAndStateID(int partid, int stateid) 54 | { 55 | if (!m_theme) return E_POINTER; 56 | 57 | m_partid = partid; 58 | m_stateid = stateid; 59 | return S_OK; 60 | } 61 | -------------------------------------------------------------------------------- /component/samples/js-smooth/JS Smooth Playlist Manager.txt: -------------------------------------------------------------------------------- 1 | // ==PREPROCESSOR== 2 | // @name "JS Smooth Playlist Manager" 3 | // @version "2018-mod" 4 | // @author "Br3tt aka Falstaff" 5 | // @import "%fb2k_component_path%samples\js-smooth\js\JScommon.js" 6 | // @import "%fb2k_component_path%samples\js-smooth\js\JSinputbox.js" 7 | // @import "%fb2k_component_path%samples\js-smooth\js\jsspm.js" 8 | // ==/PREPROCESSOR== 9 | 10 | /* 11 | [Features] 12 | * order playlists by dragging items with the mouse 13 | * presets autoplaylists available 14 | * True Smooth Scrolling 15 | * Screen Touch support 16 | * Header bar at Top (can be hidden with CTRL+T) 17 | * Vertical Scrollbar (can be hidden with CTRL+B) 18 | * Filter box 19 | * Custom or Cover art Wallpaper as background supported (including a blur effect) 20 | * Windows scaling compliant (you can adjust zoom size in real time with CTRL+mousewheel) 21 | * Custom Panel Colors (in Properties window) 22 | * ... and more! 23 | 24 | [Tips] 25 | * Hold SHIFT key + right click to display Configure script and panel Properties entries 26 | * Change colors and fonts in foobar2000 Preferences > DefaultUI or ColumsUI 27 | * Some minor settings can be changed in window Properties (SHIFT + right click > Properties), use it carefully 28 | * Right Click on items for contextual menu for the selection 29 | * CTRL+T to toggle the columns toolbar 30 | * CTRL+B to toggle the scrollbar 31 | * Hold CTRL + Mouse Wheel to scale elements (useful for 'retina' screens) 32 | * Hold SHIFT + Mouse Wheel to scale group header and so the cover art size 33 | * F2 key to rename selected/active playlist 34 | * ... etc 35 | */ 36 | -------------------------------------------------------------------------------- /scintilla/src/KeyMap.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file KeyMap.h 3 | ** Defines a mapping between keystrokes and commands. 4 | **/ 5 | // Copyright 1998-2001 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef KEYMAP_H 9 | #define KEYMAP_H 10 | 11 | namespace Scintilla { 12 | 13 | #define SCI_NORM 0 14 | #define SCI_SHIFT SCMOD_SHIFT 15 | #define SCI_CTRL SCMOD_CTRL 16 | #define SCI_ALT SCMOD_ALT 17 | #define SCI_META SCMOD_META 18 | #define SCI_SUPER SCMOD_SUPER 19 | #define SCI_CSHIFT (SCI_CTRL | SCI_SHIFT) 20 | #define SCI_ASHIFT (SCI_ALT | SCI_SHIFT) 21 | 22 | /** 23 | */ 24 | class KeyModifiers { 25 | public: 26 | int key; 27 | int modifiers; 28 | KeyModifiers(int key_, int modifiers_) noexcept : key(key_), modifiers(modifiers_) { 29 | } 30 | bool operator<(const KeyModifiers &other) const noexcept { 31 | if (key == other.key) 32 | return modifiers < other.modifiers; 33 | else 34 | return key < other.key; 35 | } 36 | }; 37 | 38 | /** 39 | */ 40 | class KeyToCommand { 41 | public: 42 | int key; 43 | int modifiers; 44 | unsigned int msg; 45 | }; 46 | 47 | /** 48 | */ 49 | class KeyMap { 50 | std::map kmap; 51 | static const KeyToCommand MapDefault[]; 52 | 53 | public: 54 | KeyMap(); 55 | ~KeyMap(); 56 | void Clear() noexcept; 57 | void AssignCmdKey(int key, int modifiers, unsigned int msg); 58 | unsigned int Find(int key, int modifiers) const; // 0 returned on failure 59 | const std::map &GetKeyMap() const noexcept; 60 | }; 61 | 62 | } 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /docs/foo_jscript_panel/Configuration-Window.md: -------------------------------------------------------------------------------- 1 | ## Configuration Window 2 | 3 | Right click any panel>`Configure` to open the `Configuration Window`. 4 | 5 | - NOTE: Some scripts may implement their own menu without a `Configure` option. If this happens, you can hold down the `Shift` and `Win` keys and then right click. This always brings up the default menu. 6 | 7 | ![Configuration Window](../images/configuration_window.png) 8 | 9 | ## Keyboard shortcuts 10 | 11 | ``` 12 | Ctrl+F: Open "Find" dialog 13 | Ctrl+G: Open "Go To Line" dialog 14 | Ctrl+H: Open "Replace" dialog 15 | Ctrl+S: Apply 16 | F3: Find Next 17 | Shift+F3: Find Previous 18 | ``` 19 | 20 | ## Main menu 21 | 22 | You can use the `File` menu to `Import` and `Export` your scripts. The `Samples` menu provides quick access to all included scripts and the rest of the options should be self explanatory! 23 | 24 | ## Reset 25 | 26 | Use this to reset back to the default script. 27 | 28 | ## Script Engine 29 | 30 | When you have `IE9` or later installed, you can choose between using the `Chakra` engine which enables `ECMAScript5` features or the standard `JScript` engine which has `ECMAScript3` levels of support. 31 | 32 | ## Edge Style 33 | 34 | This item is disabled when using `Default UI`. Since [foobar2000](https://foobar2000.org) `v1.4`, new splitter settings override individual panels. 35 | 36 | For `Columns UI` users, there are 3 options: `None`, `Grey` and `Sunken`. 37 | 38 | ## Pseudo Transparent 39 | 40 | This item is disabled in `Default UI` as it has no effect. 41 | 42 | For `Columns UI` users, it's only usable when added as a toolbar or when contained within `Panel Stack splitter`. 43 | -------------------------------------------------------------------------------- /docs/foo_jscript_panel/Samples.md: -------------------------------------------------------------------------------- 1 | ## Samples 2 | 3 | ### Requirements 4 | 5 | Although the component has been updated to run on any version of `Windows` supported by [foobar2000](https://foobar2000.org) itself, some scripts have their own. 6 | 7 | ### Samples\Basic 8 | 9 | All these should work fine on any system. 10 | 11 | ### Samples\Complete 12 | 13 | Most scripts in this folder require the installation of [FontAwesome](https://github.com/FortAwesome/Font-Awesome/blob/fa-4/fonts/fontawesome-webfont.ttf?raw=true) 14 | 15 | All these scripts should work on any system with `IE8` or later installed. 16 | 17 | There are three exceptions: 18 | 19 | `Listenbrainz` requires any version of `Windows` with `IE9` or later installed. Note that since this script was created, it has been superceded by a [dedicated component](../foo_listenbrainz2.md). 20 | 21 | `Thumbs` can display existing images on any system but requires any version of `Windows` with at least `IE9` to download new ones. Downloading does not work on `Windows XP`/`WINE`. 22 | 23 | `Last.fm Lover` doesn't work on `Windows XP`/`WINE`. Requires any version of `Windows` with `IE9` or later. 24 | 25 | ### Samples\JSPlaylist, Samples\JS-Smooth 26 | 27 | These scripts should work fine on any system. The following fonts are required: 28 | 29 | [Guifx v2 Transports.ttf](http://blog.guifx.com/2009/04/02/guifx-v2-transport-font/), `wingdings2.ttf`, `wingdings3.ttf` 30 | 31 | If you have `Microsoft Office` installed, you should have the `wingdings` fonts. If not, you'll have to search for them. 32 | 33 | ### Usage 34 | 35 | From the [Configuration Window](Configuration-Window.md) simply use the `Samples` menu to quickly select the one you want. 36 | -------------------------------------------------------------------------------- /component/samples/complete/properties.txt: -------------------------------------------------------------------------------- 1 | // ==PREPROCESSOR== 2 | // @name "Properties" 3 | // @author "marc2003" 4 | // @import "%fb2k_component_path%samples\complete\js\lodash.min.js" 5 | // @import "%fb2k_component_path%samples\complete\js\helpers.js" 6 | // @import "%fb2k_component_path%samples\complete\js\panel.js" 7 | // @import "%fb2k_component_path%samples\complete\js\list.js" 8 | // ==/PREPROCESSOR== 9 | 10 | var panel = new _.panel(); 11 | var list = new _.list('properties', LM, TM, 0, 0); 12 | 13 | // uncomment if you want to display data from the JScript Panel database documented here: https://kbuffington.github.io/foo_jscript_panel/foo_jscript_panel/Playback-Stats.html 14 | // list.custom_fields = ['JSP_PLAYCOUNT', 'JSP_LOVED', 'JSP_FIRST_PLAYED', 'JSP_LAST_PLAYED', 'JSP_RATING']; 15 | 16 | panel.item_focus_change(); 17 | 18 | function on_size() { 19 | panel.size(); 20 | list.w = panel.w - (LM * 2); 21 | list.h = panel.h - TM; 22 | list.size(); 23 | } 24 | 25 | function on_paint(gr) { 26 | panel.paint(gr); 27 | gr.GdiDrawText(list.header_text(), panel.fonts.title, panel.colours.highlight, LM, 0, panel.w - (LM * 2), TM, LEFT); 28 | gr.DrawLine(list.x, list.y + 1, list.x + list.w, list.y + 1, 1, panel.colours.highlight); 29 | list.paint(gr); 30 | } 31 | 32 | function on_metadb_changed() { 33 | list.metadb_changed(); 34 | } 35 | 36 | function on_mouse_wheel(s) { 37 | list.wheel(s); 38 | } 39 | 40 | function on_mouse_move(x, y) { 41 | list.move(x, y); 42 | } 43 | 44 | function on_mouse_lbtn_up(x, y) { 45 | list.lbtn_up(x, y); 46 | } 47 | 48 | function on_key_down(k) { 49 | list.key_down(k); 50 | } 51 | 52 | function on_mouse_rbtn_up(x, y) { 53 | return panel.rbtn_up(x, y, list); 54 | } 55 | -------------------------------------------------------------------------------- /component/samples/basic/ApplyMask.txt: -------------------------------------------------------------------------------- 1 | // ==PREPROCESSOR== 2 | // @name "ApplyMask" 3 | // @author "T.P Wang / marc2003" 4 | // @import "%fb2k_component_path%docs\flags.txt" 5 | // @import "%fb2k_component_path%docs\helpers.txt" 6 | // ==/PREPROCESSOR== 7 | 8 | var g_img = gdi.Image(fb.ComponentPath + 'samples\\basic\\images\\post.jpg'); 9 | var font = gdi.Font('Segoe UI', 16, 1); 10 | var ww = 0, wh = 0; 11 | var applied = false; 12 | 13 | function on_size() { 14 | ww = window.Width; 15 | wh = window.Height; 16 | } 17 | 18 | function on_paint(gr) { 19 | if (g_img) { 20 | // Keep aspect ratio 21 | var scale_w = ww / g_img.Width; 22 | var scale_h = wh / g_img.Height; 23 | var scale = Math.min(scale_w, scale_h); 24 | var pos_x = 0, pos_y = 0; 25 | if (scale_w < scale_h) 26 | pos_y = (wh - g_img.height * scale) / 2; 27 | else if (scale_w > scale_h) 28 | pos_x = (ww - g_img.Width * scale) / 2; 29 | gr.DrawImage(g_img, pos_x, pos_y, g_img.Width * scale, g_img.Height * scale, 0, 0, g_img.Width, g_img.Height); 30 | } 31 | if (!applied) { 32 | gr.FillSolidRect(0, 0, ww, 24, RGB(0, 0, 0)); 33 | gr.GdiDrawText('Double click panel to apply mask', font, RGB(255, 255, 255), 0, 0, ww, 24, DT_CENTER); 34 | } 35 | } 36 | 37 | function on_mouse_lbtn_dblclk() { 38 | if (!applied) 39 | apply(); 40 | } 41 | 42 | function apply() { 43 | var g_img_mask = gdi.Image(fb.ComponentPath + 'samples\\basic\\images\\mask.png'); 44 | // mask *MUST* be the same size as g_img 45 | var mask = g_img_mask.Resize(g_img.Width, g_img.Height); 46 | // Apply mask image to g_img 47 | g_img.ApplyMask(mask); 48 | // Dispose() method is used to free unused resource 49 | mask.Dispose(); 50 | applied = true; 51 | window.Repaint(); 52 | } 53 | -------------------------------------------------------------------------------- /scintilla/lexlib/LexerSimple.cxx: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file LexerSimple.cxx 3 | ** A simple lexer with no state. 4 | **/ 5 | // Copyright 1998-2010 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "ILexer.h" 14 | #include "Scintilla.h" 15 | #include "SciLexer.h" 16 | 17 | #include "PropSetSimple.h" 18 | #include "WordList.h" 19 | #include "LexAccessor.h" 20 | #include "Accessor.h" 21 | #include "LexerModule.h" 22 | #include "LexerBase.h" 23 | #include "LexerSimple.h" 24 | 25 | using namespace Scintilla; 26 | 27 | LexerSimple::LexerSimple(const LexerModule *module_) : 28 | LexerBase(module_->LexClasses(), module_->NamedStyles()), 29 | module(module_) { 30 | for (int wl = 0; wl < module->GetNumWordLists(); wl++) { 31 | if (!wordLists.empty()) 32 | wordLists += "\n"; 33 | wordLists += module->GetWordListDescription(wl); 34 | } 35 | } 36 | 37 | const char * SCI_METHOD LexerSimple::DescribeWordListSets() { 38 | return wordLists.c_str(); 39 | } 40 | 41 | void SCI_METHOD LexerSimple::Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) { 42 | Accessor astyler(pAccess, &props); 43 | module->Lex(startPos, lengthDoc, initStyle, keyWordLists, astyler); 44 | astyler.Flush(); 45 | } 46 | 47 | void SCI_METHOD LexerSimple::Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) { 48 | if (props.GetInt("fold")) { 49 | Accessor astyler(pAccess, &props); 50 | module->Fold(startPos, lengthDoc, initStyle, keyWordLists, astyler); 51 | astyler.Flush(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/script_interface/MainMenuManager.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "MainMenuManager.h" 3 | 4 | MainMenuManager::MainMenuManager() {} 5 | MainMenuManager::~MainMenuManager() {} 6 | 7 | void MainMenuManager::FinalRelease() 8 | { 9 | m_mm.release(); 10 | } 11 | 12 | STDMETHODIMP MainMenuManager::BuildMenu(IMenuObj* p, UINT base_id) 13 | { 14 | if (m_mm.is_empty()) return E_POINTER; 15 | 16 | HMENU menuid; 17 | p->get__ID(&menuid); 18 | 19 | // HACK: workaround for foo_menu_addons 20 | try 21 | { 22 | m_mm->generate_menu_win32(menuid, base_id, SIZE_MAX, mainmenu_manager::flag_show_shortcuts); 23 | } 24 | catch (...) {} 25 | 26 | return S_OK; 27 | } 28 | 29 | STDMETHODIMP MainMenuManager::ExecuteByID(UINT id, VARIANT_BOOL* p) 30 | { 31 | if (m_mm.is_empty() || !p) return E_POINTER; 32 | 33 | *p = TO_VARIANT_BOOL(m_mm->execute_command(id)); 34 | return S_OK; 35 | } 36 | 37 | STDMETHODIMP MainMenuManager::Init(BSTR root_name) 38 | { 39 | using t_valid_root_name = std::pair; 40 | 41 | static const std::vector valid_root_names = 42 | { 43 | { L"file", &mainmenu_groups::file }, 44 | { L"edit", &mainmenu_groups::edit }, 45 | { L"view", &mainmenu_groups::view }, 46 | { L"playback", &mainmenu_groups::playback }, 47 | { L"library", &mainmenu_groups::library }, 48 | { L"help", &mainmenu_groups::help } 49 | }; 50 | 51 | const auto it = std::find_if(valid_root_names.begin(), valid_root_names.end(), [&](const t_valid_root_name& item) { return _wcsicmp(root_name, item.first) == 0; }); 52 | if (it != valid_root_names.end()) 53 | { 54 | m_mm = standard_api_create_t(); 55 | m_mm->instantiate(*it->second); 56 | return S_OK; 57 | } 58 | return E_INVALIDARG; 59 | } 60 | -------------------------------------------------------------------------------- /src/ui/ui_conf.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "editor_ctrl.h" 3 | 4 | class panel_window; 5 | 6 | class CDialogConf : public CDialogImpl 7 | { 8 | public: 9 | CDialogConf(panel_window* p_parent); 10 | 11 | BEGIN_MSG_MAP_EX(CDialogConf) 12 | CHAIN_MSG_MAP_MEMBER(m_resizer) 13 | MSG_WM_INITDIALOG(OnInitDialog) 14 | MSG_WM_NOTIFY(OnNotify) 15 | COMMAND_ID_HANDLER_EX(ID_FILE_IMPORT, OnFileImport) 16 | COMMAND_ID_HANDLER_EX(ID_FILE_EXPORT, OnFileExport) 17 | COMMAND_ID_HANDLER_EX(IDC_BTN_RESET, OnReset) 18 | COMMAND_ID_HANDLER_EX(IDC_BTN_APPLY, OnCloseCmd) 19 | COMMAND_RANGE_HANDLER_EX(IDOK, IDCANCEL, OnCloseCmd) 20 | COMMAND_RANGE_HANDLER_EX(ID_SAMPLES_BEGIN, ID_SAMPLES_END, OnSamples) 21 | COMMAND_RANGE_HANDLER_EX(ID_DOCS_BEGIN, ID_DOCS_END, OnDocs) 22 | COMMAND_RANGE_HANDLER_EX(ID_LINKS_BEGIN, ID_LINKS_END, OnLinks) 23 | REFLECT_NOTIFICATIONS() 24 | END_MSG_MAP() 25 | 26 | enum { IDD = IDD_DIALOG_CONF }; 27 | 28 | BOOL OnInitDialog(CWindow, LPARAM); 29 | LRESULT OnNotify(int, LPNMHDR pnmh); 30 | pfc::string8_fast GetText(); 31 | void Apply(); 32 | void BuildMenu(); 33 | void OnCloseCmd(UINT, int nID, CWindow); 34 | void OnDocs(UINT, int nID, CWindow); 35 | void OnFileImport(UINT, int, CWindow); 36 | void OnFileExport(UINT, int, CWindow); 37 | void OnLinks(UINT, int nID, CWindow); 38 | void OnReset(UINT, int, CWindow); 39 | void OnSamples(UINT, int nID, CWindow); 40 | 41 | private: 42 | CCheckBox m_transparent_check; 43 | CComboBox m_edge_combo; 44 | CComboBox m_engine_combo; 45 | CDialogResizeHelper m_resizer; 46 | CMenu m_menu; 47 | CScriptEditorCtrl m_editorctrl; 48 | panel_window* m_parent; 49 | pfc::string8_fast m_caption; 50 | pfc::string_list_impl m_docs; 51 | pfc::string_list_impl m_samples; 52 | }; 53 | -------------------------------------------------------------------------------- /scintilla/src/MarginView.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file MarginView.h 3 | ** Defines the appearance of the editor margin. 4 | **/ 5 | // Copyright 1998-2014 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef MARGINVIEW_H 9 | #define MARGINVIEW_H 10 | 11 | namespace Scintilla { 12 | 13 | void DrawWrapMarker(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourDesired wrapColour); 14 | 15 | typedef void (*DrawWrapMarkerFn)(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourDesired wrapColour); 16 | 17 | /** 18 | * MarginView draws the margins. 19 | */ 20 | class MarginView { 21 | public: 22 | std::unique_ptr pixmapSelMargin; 23 | std::unique_ptr pixmapSelPattern; 24 | std::unique_ptr pixmapSelPatternOffset1; 25 | // Highlight current folding block 26 | HighlightDelimiter highlightDelimiter; 27 | 28 | int wrapMarkerPaddingRight; // right-most pixel padding of wrap markers 29 | /** Some platforms, notably PLAT_CURSES, do not support Scintilla's native 30 | * DrawWrapMarker function for drawing wrap markers. Allow those platforms to 31 | * override it instead of creating a new method in the Surface class that 32 | * existing platforms must implement as empty. */ 33 | DrawWrapMarkerFn customDrawWrapMarker; 34 | 35 | MarginView() noexcept; 36 | 37 | void DropGraphics(bool freeObjects); 38 | void AllocateGraphics(const ViewStyle &vsDraw); 39 | void RefreshPixMaps(Surface *surfaceWindow, WindowID wid, const ViewStyle &vsDraw); 40 | void PaintMargin(Surface *surface, Sci::Line topLine, PRectangle rc, PRectangle rcMargin, 41 | const EditModel &model, const ViewStyle &vs); 42 | }; 43 | 44 | } 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /scintilla/src/CaseConvert.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | // Encoding: UTF-8 3 | /** @file CaseConvert.h 4 | ** Performs Unicode case conversions. 5 | ** Does not handle locale-sensitive case conversion. 6 | **/ 7 | // Copyright 2013 by Neil Hodgson 8 | // The License.txt file describes the conditions under which this software may be distributed. 9 | 10 | #ifndef CASECONVERT_H 11 | #define CASECONVERT_H 12 | 13 | namespace Scintilla { 14 | 15 | enum CaseConversion { 16 | CaseConversionFold, 17 | CaseConversionUpper, 18 | CaseConversionLower 19 | }; 20 | 21 | class ICaseConverter { 22 | public: 23 | virtual size_t CaseConvertString(char *converted, size_t sizeConverted, const char *mixed, size_t lenMixed) = 0; 24 | }; 25 | 26 | ICaseConverter *ConverterFor(enum CaseConversion conversion); 27 | 28 | // Returns a UTF-8 string. Empty when no conversion 29 | const char *CaseConvert(int character, enum CaseConversion conversion); 30 | 31 | // When performing CaseConvertString, the converted value may be up to 3 times longer than the input. 32 | // Ligatures are often decomposed into multiple characters and long cases include: 33 | // ΐ "\xce\x90" folds to ΐ "\xce\xb9\xcc\x88\xcc\x81" 34 | const int maxExpansionCaseConversion=3; 35 | 36 | // Converts a mixed case string using a particular conversion. 37 | // Result may be a different length to input and the length is the return value. 38 | // If there is not enough space then 0 is returned. 39 | size_t CaseConvertString(char *converted, size_t sizeConverted, const char *mixed, size_t lenMixed, enum CaseConversion conversion); 40 | 41 | // Converts a mixed case string using a particular conversion. 42 | std::string CaseConvertString(const std::string &s, enum CaseConversion conversion); 43 | 44 | } 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /docs/foo_jscript_panel/Overview.md: -------------------------------------------------------------------------------- 1 | ## Overview 2 | 3 | This component is based on [WSH Panel Mod](https://code.google.com/archive/p/foo-wsh-panel-mod/). 4 | 5 | It allows the creation of customisable panels that can be written with `Javascript` rather than the `C++` required by the [foobar2000 SDK](https://www.foobar2000.org/SDK). 6 | 7 | Under the hood, it uses `Windows Script host`. It is possible to use `ActiveX` objects like `FileSystemObject` and `XMLHttpRequest` to work with the local file system, access the internet, etc. 8 | 9 | If your system has `IE9` or later installed, you'll have access to `ECMAScript5` features. You'll need to make sure the `Chakra` script engine is selected in the [Configuration Window](Configuration-Window.md). 10 | 11 | As of `v2`, `Windows XP SP3` is now supported and support for `Vista/7/WINE` with `IE8` has been restored. Of course you'll be limited here to `ECMAScript3`! 12 | 13 | Here are just some of the features provided by the component... 14 | 15 | * Custom drawing of text, external images, lines, rectangles, etc. 16 | * Use fonts/colours from the main preferences of whichever user interface you are using. 17 | * Executing main/context menu commands. 18 | * Ability to create custom buttons/menus. 19 | * Capture keystrokes/mouse movement/clicks. 20 | * Callbacks can be used to trigger code based on [foobar2000](https://foobar2000.org) events. See [callbacks.txt](https://raw.githubusercontent.com/marc2k3/foo_jscript_panel/master/foo_jscript_panel/docs/Callbacks.txt). 21 | * Read/write file tags. 22 | * Complete manipulation of playlists. 23 | * Media Library display/sorting/filtering 24 | * Save settings on a per panel basis. You can also save/load settings from .ini files or write your own functions to read and write plain text/JSON files etc. 25 | * And much more... 26 | -------------------------------------------------------------------------------- /docs/_layouts/default.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | {% seo %} 11 | 12 | 13 | 14 | 15 |
16 |
17 |

{{ site.title | default: site.github.repository_name }}

18 |

{{ site.description | default: site.github.project_tagline }}

19 | JScript Panel :: 20 | Last.fm Playcount Sync :: 21 | ListenBrainz 2 :: 22 | MusicBrainz Tagger 23 |
24 |
25 | 26 |
27 |
28 | {{ content }} 29 |
30 |
31 | 32 | {% if site.google_analytics %} 33 | 41 | {% endif %} 42 | 43 | 44 | -------------------------------------------------------------------------------- /component/samples/complete/last.fm similar artists + user charts + recent tracks.txt: -------------------------------------------------------------------------------- 1 | // ==PREPROCESSOR== 2 | // @name "Last.fm Similar Artists + User Charts + Recent Tracks" 3 | // @author "marc2003" 4 | // @import "%fb2k_component_path%samples\complete\js\lodash.min.js" 5 | // @import "%fb2k_component_path%samples\complete\js\helpers.js" 6 | // @import "%fb2k_component_path%samples\complete\js\panel.js" 7 | // @import "%fb2k_component_path%samples\complete\js\list.js" 8 | // @import "%fb2k_component_path%samples\complete\js\lastfm.js" 9 | // ==/PREPROCESSOR== 10 | 11 | var panel = new _.panel(); 12 | var lastfm = new _.lastfm(); 13 | var list = new _.list('lastfm_info', LM, TM, 0, 0); 14 | 15 | panel.item_focus_change(); 16 | 17 | function on_notify_data(name, data) { 18 | lastfm.notify_data(name, data); 19 | } 20 | 21 | function on_size() { 22 | panel.size(); 23 | list.w = panel.w - (LM * 2); 24 | list.h = panel.h - TM; 25 | list.size(); 26 | } 27 | 28 | function on_paint(gr) { 29 | panel.paint(gr); 30 | gr.GdiDrawText(list.header_text(), panel.fonts.title, panel.colours.highlight, LM, 0, panel.w - (LM * 2), TM, LEFT); 31 | gr.DrawLine(list.x, list.y + 1, list.x + list.w, list.y + 1, 1, panel.colours.highlight); 32 | list.paint(gr); 33 | } 34 | 35 | function on_playback_new_track() { 36 | list.playback_new_track(); 37 | } 38 | 39 | function on_playback_time() { 40 | list.playback_time(); 41 | } 42 | 43 | function on_metadb_changed() { 44 | list.metadb_changed(); 45 | } 46 | 47 | function on_mouse_wheel(s) { 48 | list.wheel(s); 49 | } 50 | 51 | function on_mouse_move(x, y) { 52 | list.move(x, y); 53 | } 54 | 55 | function on_mouse_lbtn_up(x, y) { 56 | list.lbtn_up(x, y); 57 | } 58 | 59 | function on_key_down(k) { 60 | list.key_down(k); 61 | } 62 | 63 | function on_mouse_rbtn_up(x, y) { 64 | return panel.rbtn_up(x, y, list); 65 | } 66 | -------------------------------------------------------------------------------- /scintilla/lexlib/StyleContext.cxx: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file StyleContext.cxx 3 | ** Lexer infrastructure. 4 | **/ 5 | // Copyright 1998-2004 by Neil Hodgson 6 | // This file is in the public domain. 7 | 8 | #include 9 | #include 10 | 11 | #include "ILexer.h" 12 | 13 | #include "LexAccessor.h" 14 | #include "Accessor.h" 15 | #include "StyleContext.h" 16 | #include "CharacterSet.h" 17 | 18 | using namespace Scintilla; 19 | 20 | bool StyleContext::MatchIgnoreCase(const char *s) { 21 | if (MakeLowerCase(ch) != static_cast(*s)) 22 | return false; 23 | s++; 24 | if (MakeLowerCase(chNext) != static_cast(*s)) 25 | return false; 26 | s++; 27 | for (int n = 2; *s; n++) { 28 | if (*s != 29 | MakeLowerCase(styler.SafeGetCharAt(currentPos + n, 0))) 30 | return false; 31 | s++; 32 | } 33 | return true; 34 | } 35 | 36 | static void getRange(Sci_PositionU start, 37 | Sci_PositionU end, 38 | LexAccessor &styler, 39 | char *s, 40 | Sci_PositionU len) { 41 | Sci_PositionU i = 0; 42 | while ((i < end - start + 1) && (i < len-1)) { 43 | s[i] = styler[start + i]; 44 | i++; 45 | } 46 | s[i] = '\0'; 47 | } 48 | 49 | void StyleContext::GetCurrent(char *s, Sci_PositionU len) { 50 | getRange(styler.GetStartSegment(), currentPos - 1, styler, s, len); 51 | } 52 | 53 | static void getRangeLowered(Sci_PositionU start, 54 | Sci_PositionU end, 55 | LexAccessor &styler, 56 | char *s, 57 | Sci_PositionU len) { 58 | Sci_PositionU i = 0; 59 | while ((i < end - start + 1) && (i < len-1)) { 60 | s[i] = MakeLowerCase(styler[start + i]); 61 | i++; 62 | } 63 | s[i] = '\0'; 64 | } 65 | 66 | void StyleContext::GetCurrentLowered(char *s, Sci_PositionU len) { 67 | getRangeLowered(styler.GetStartSegment(), currentPos - 1, styler, s, len); 68 | } 69 | -------------------------------------------------------------------------------- /component/samples/js-smooth/JS Smooth Playlist.txt: -------------------------------------------------------------------------------- 1 | // ==PREPROCESSOR== 2 | // @name "JS Smooth Playlist" 3 | // @version "2018-mod" 4 | // @author "Br3tt aka Falstaff" 5 | // @import "%fb2k_component_path%samples\js-smooth\js\JScommon.js" 6 | // @import "%fb2k_component_path%samples\js-smooth\js\JSinputbox.js" 7 | // @import "%fb2k_component_path%samples\js-smooth\js\jssp.js" 8 | // ==/PREPROCESSOR== 9 | 10 | /* 11 | [Features] 12 | * Groups (collpase or expand, add extra lines, ...) 13 | * True Smooth Scrolling 14 | * Screen Touch support 15 | * "in track" rating system 16 | * Playlist Header at Top (can be hidden with CTRL+T) 17 | * Vertical Scrollbar (can be hidden with CTRL+B) 18 | * Custom or Cover art Wallpaper as background supported (including a blur effect) 19 | * Collapsable playlists panel to easily drag'n drop tracks to a another playlist 20 | * Windows scaling compliant (you can adjust zoom size in real time with CTRL+mousewheel) 21 | * Custom Panel Colors (in Properties window) 22 | * ... and more! 23 | 24 | [Tips] 25 | * Hold SHIFT key + right click to display Configure script and panel Properties entries 26 | * Change colors and fonts in foobar2000 Preferences > DefaultUI or ColumsUI 27 | * Some minor settings can be changed in window Properties (SHIFT + right click > Properties), use it carefully 28 | * Use Keyboard for "jumping" to an artist in the playlist (incremental search feature like in ELPlaylist) or to navigate in playlist 29 | * Right Click on items for contextual menu for the selection 30 | * CTRL+T to toggle the columns toolbar 31 | * CTRL+B to toggle the scrollbar 32 | * Hold CTRL + Mouse Wheel to scale elements (useful for 'retina' screens) 33 | * Hold SHIFT + Mouse Wheel to scale group header and so the cover art size 34 | * F3 key to show now playing track 35 | * F5 key to refresh covers 36 | * ... etc 37 | */ 38 | -------------------------------------------------------------------------------- /scintilla/src/ContractionState.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file ContractionState.h 3 | ** Manages visibility of lines for folding and wrapping. 4 | **/ 5 | // Copyright 1998-2007 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef CONTRACTIONSTATE_H 9 | #define CONTRACTIONSTATE_H 10 | 11 | namespace Scintilla { 12 | 13 | /** 14 | */ 15 | class IContractionState { 16 | public: 17 | virtual ~IContractionState() {}; 18 | 19 | virtual void Clear()=0; 20 | 21 | virtual Sci::Line LinesInDoc() const=0; 22 | virtual Sci::Line LinesDisplayed() const=0; 23 | virtual Sci::Line DisplayFromDoc(Sci::Line lineDoc) const=0; 24 | virtual Sci::Line DisplayLastFromDoc(Sci::Line lineDoc) const=0; 25 | virtual Sci::Line DocFromDisplay(Sci::Line lineDisplay) const=0; 26 | 27 | virtual void InsertLines(Sci::Line lineDoc, Sci::Line lineCount)=0; 28 | virtual void DeleteLines(Sci::Line lineDoc, Sci::Line lineCount)=0; 29 | 30 | virtual bool GetVisible(Sci::Line lineDoc) const=0; 31 | virtual bool SetVisible(Sci::Line lineDocStart, Sci::Line lineDocEnd, bool isVisible)=0; 32 | virtual bool HiddenLines() const=0; 33 | 34 | virtual const char *GetFoldDisplayText(Sci::Line lineDoc) const=0; 35 | virtual bool SetFoldDisplayText(Sci::Line lineDoc, const char *text)=0; 36 | 37 | virtual bool GetExpanded(Sci::Line lineDoc) const=0; 38 | virtual bool SetExpanded(Sci::Line lineDoc, bool isExpanded)=0; 39 | virtual Sci::Line ContractedNext(Sci::Line lineDocStart) const=0; 40 | 41 | virtual int GetHeight(Sci::Line lineDoc) const=0; 42 | virtual bool SetHeight(Sci::Line lineDoc, int height)=0; 43 | 44 | virtual void ShowAll()=0; 45 | }; 46 | 47 | std::unique_ptr ContractionStateCreate(bool largeDocument); 48 | 49 | } 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /scintilla/src/CharClassify.cxx: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file CharClassify.cxx 3 | ** Character classifications used by Document and RESearch. 4 | **/ 5 | // Copyright 2006 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "CharacterSet.h" 14 | #include "CharClassify.h" 15 | 16 | using namespace Scintilla; 17 | 18 | CharClassify::CharClassify() : charClass{} { 19 | SetDefaultCharClasses(true); 20 | } 21 | 22 | void CharClassify::SetDefaultCharClasses(bool includeWordClass) { 23 | // Initialize all char classes to default values 24 | for (int ch = 0; ch < 256; ch++) { 25 | if (ch == '\r' || ch == '\n') 26 | charClass[ch] = ccNewLine; 27 | else if (ch < 0x20 || ch == ' ') 28 | charClass[ch] = ccSpace; 29 | else if (includeWordClass && (ch >= 0x80 || IsAlphaNumeric(ch) || ch == '_')) 30 | charClass[ch] = ccWord; 31 | else 32 | charClass[ch] = ccPunctuation; 33 | } 34 | } 35 | 36 | void CharClassify::SetCharClasses(const unsigned char *chars, cc newCharClass) { 37 | // Apply the newCharClass to the specifed chars 38 | if (chars) { 39 | while (*chars) { 40 | charClass[*chars] = static_cast(newCharClass); 41 | chars++; 42 | } 43 | } 44 | } 45 | 46 | int CharClassify::GetCharsOfClass(cc characterClass, unsigned char *buffer) const { 47 | // Get characters belonging to the given char class; return the number 48 | // of characters (if the buffer is NULL, don't write to it). 49 | int count = 0; 50 | for (int ch = maxChar - 1; ch >= 0; --ch) { 51 | if (charClass[ch] == characterClass) { 52 | ++count; 53 | if (buffer) { 54 | *buffer = static_cast(ch); 55 | buffer++; 56 | } 57 | } 58 | } 59 | return count; 60 | } 61 | -------------------------------------------------------------------------------- /src/script_interface/GdiRawBitmap.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "GdiRawBitmap.h" 3 | 4 | GdiRawBitmap::GdiRawBitmap(Gdiplus::Bitmap* p_bmp) 5 | { 6 | PFC_ASSERT(p_bmp != nullptr); 7 | m_width = p_bmp->GetWidth(); 8 | m_height = p_bmp->GetHeight(); 9 | 10 | m_hdc = CreateCompatibleDC(nullptr); 11 | m_hbmp = CreateHBITMAP(p_bmp); 12 | m_hbmpold = static_cast(SelectObject(m_hdc, m_hbmp)); 13 | } 14 | 15 | GdiRawBitmap::~GdiRawBitmap() {} 16 | 17 | HBITMAP GdiRawBitmap::CreateHBITMAP(Gdiplus::Bitmap* bitmap_ptr) 18 | { 19 | const Gdiplus::Rect rect(0, 0, bitmap_ptr->GetWidth(), bitmap_ptr->GetHeight()); 20 | Gdiplus::BitmapData bmpdata; 21 | 22 | if (bitmap_ptr->LockBits(&rect, Gdiplus::ImageLockModeRead, PixelFormat32bppPARGB, &bmpdata) != Gdiplus::Ok) 23 | { 24 | return nullptr; 25 | } 26 | 27 | BITMAP bm; 28 | bm.bmType = 0; 29 | bm.bmWidth = bmpdata.Width; 30 | bm.bmHeight = bmpdata.Height; 31 | bm.bmWidthBytes = bmpdata.Stride; 32 | bm.bmPlanes = 1; 33 | bm.bmBitsPixel = 32; 34 | bm.bmBits = bmpdata.Scan0; 35 | 36 | HBITMAP hBitmap = CreateBitmapIndirect(&bm); 37 | bitmap_ptr->UnlockBits(&bmpdata); 38 | return hBitmap; 39 | } 40 | 41 | void GdiRawBitmap::FinalRelease() 42 | { 43 | if (m_hdc) 44 | { 45 | SelectObject(m_hdc, m_hbmpold); 46 | DeleteDC(m_hdc); 47 | m_hdc = nullptr; 48 | } 49 | 50 | if (m_hbmp) 51 | { 52 | DeleteBitmap(m_hbmp); 53 | m_hbmp = nullptr; 54 | } 55 | } 56 | 57 | STDMETHODIMP GdiRawBitmap::get__Handle(HDC* p) 58 | { 59 | if (!m_hdc || !p) return E_POINTER; 60 | 61 | *p = m_hdc; 62 | return S_OK; 63 | } 64 | 65 | STDMETHODIMP GdiRawBitmap::get_Height(UINT* p) 66 | { 67 | if (!m_hdc || !p) return E_POINTER; 68 | 69 | *p = m_height; 70 | return S_OK; 71 | } 72 | 73 | STDMETHODIMP GdiRawBitmap::get_Width(UINT* p) 74 | { 75 | if (!m_hdc || !p) return E_POINTER; 76 | 77 | *p = m_width; 78 | return S_OK; 79 | } 80 | -------------------------------------------------------------------------------- /src/script_interface/TitleFormat.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "TitleFormat.h" 3 | #include "helpers.h" 4 | 5 | TitleFormat::TitleFormat(BSTR pattern) 6 | { 7 | titleformat_compiler::get()->compile_safe(m_obj, string_utf8_from_wide(pattern)); 8 | } 9 | 10 | TitleFormat::~TitleFormat() {} 11 | 12 | void TitleFormat::FinalRelease() 13 | { 14 | m_obj.release(); 15 | } 16 | 17 | STDMETHODIMP TitleFormat::get__ptr(void** pp) 18 | { 19 | if (!pp) return E_POINTER; 20 | 21 | *pp = m_obj.get_ptr(); 22 | return S_OK; 23 | } 24 | 25 | STDMETHODIMP TitleFormat::Eval(BSTR* p) 26 | { 27 | if (m_obj.is_empty() || !p) return E_POINTER; 28 | 29 | pfc::string8_fast str; 30 | playback_control::get()->playback_format_title(nullptr, str, m_obj, nullptr, playback_control::display_level_all); 31 | *p = TO_BSTR(str); 32 | return S_OK; 33 | } 34 | 35 | STDMETHODIMP TitleFormat::EvalWithMetadb(IMetadbHandle* handle, BSTR* p) 36 | { 37 | if (m_obj.is_empty() || !p) return E_POINTER; 38 | 39 | metadb_handle* ptr = nullptr; 40 | GET_PTR(handle, ptr); 41 | 42 | pfc::string8_fast str; 43 | ptr->format_title(nullptr, str, m_obj, nullptr); 44 | *p = TO_BSTR(str); 45 | return S_OK; 46 | } 47 | 48 | STDMETHODIMP TitleFormat::EvalWithMetadbs(IMetadbHandleList* handles, VARIANT* p) 49 | { 50 | if (m_obj.is_empty() || !p) return E_POINTER; 51 | 52 | metadb_handle_list* handles_ptr = nullptr; 53 | GET_PTR(handles, handles_ptr); 54 | 55 | const size_t count = handles_ptr->get_count(); 56 | 57 | str_vec strings; 58 | for (size_t i = 0; i < count; ++i) 59 | { 60 | pfc::string8_fast str; 61 | handles_ptr->get_item(i)->format_title(nullptr, str, m_obj, nullptr); 62 | strings.emplace_back(str.get_ptr()); 63 | } 64 | 65 | com_array helper; 66 | if (!helper.create(strings)) return E_OUTOFMEMORY; 67 | 68 | p->vt = VT_ARRAY | VT_VARIANT; 69 | p->parray = helper.get_ptr(); 70 | return S_OK; 71 | } 72 | -------------------------------------------------------------------------------- /component/samples/complete/playback buttons.txt: -------------------------------------------------------------------------------- 1 | // ==PREPROCESSOR== 2 | // @name "Playback Buttons" 3 | // @author "marc2003" 4 | // @import "%fb2k_component_path%samples\complete\js\lodash.min.js" 5 | // @import "%fb2k_component_path%samples\complete\js\helpers.js" 6 | // @import "%fb2k_component_path%samples\complete\js\panel.js" 7 | // ==/PREPROCESSOR== 8 | 9 | var panel = new _.panel('custom_background'); 10 | var buttons = new _.buttons(); 11 | var bs = _.scale(24); 12 | 13 | buttons.update = function () { 14 | this.buttons.stop = new _.button(0, 0, bs, bs, {normal : 'buttons\\stop.png'}, function (x, y, mask) { fb.Stop(); }, 'Stop'); 15 | this.buttons.play = new _.button(bs, 0, bs, bs, {normal : !fb.IsPlaying || fb.IsPaused ? 'buttons\\play.png' : 'buttons\\pause.png'}, function (x, y, mask) { fb.PlayOrPause(); }, !fb.IsPlaying || fb.IsPaused ? 'Play' : 'Pause'); 16 | this.buttons.previous = new _.button(bs * 2, 0, bs, bs, {normal : 'buttons\\previous.png'}, function (x, y, mask) { fb.Prev(); }, 'Previous'); 17 | this.buttons.next = new _.button(bs * 3, 0, bs, bs, {normal : 'buttons\\next.png'}, function (x, y, mask) { fb.Next(); }, 'Next'); 18 | } 19 | 20 | function on_size() { 21 | panel.size(); 22 | buttons.update(); 23 | } 24 | 25 | function on_paint(gr) { 26 | panel.paint(gr); 27 | buttons.paint(gr); 28 | } 29 | 30 | function on_playback_stop() { 31 | buttons.update(); 32 | window.Repaint(); 33 | } 34 | 35 | function on_playback_pause() { 36 | buttons.update(); 37 | window.Repaint(); 38 | } 39 | 40 | function on_playback_starting() { 41 | buttons.update(); 42 | window.Repaint(); 43 | } 44 | 45 | function on_mouse_move(x, y) { 46 | buttons.move(x, y); 47 | } 48 | 49 | function on_mouse_leave() { 50 | buttons.leave(); 51 | } 52 | 53 | function on_mouse_lbtn_up(x, y, mask) { 54 | buttons.lbtn_up(x, y, mask); 55 | } 56 | 57 | function on_mouse_rbtn_up(x, y) { 58 | return panel.rbtn_up(x, y); 59 | } 60 | -------------------------------------------------------------------------------- /scintilla/src/Indicator.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file Indicator.h 3 | ** Defines the style of indicators which are text decorations such as underlining. 4 | **/ 5 | // Copyright 1998-2001 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef INDICATOR_H 9 | #define INDICATOR_H 10 | 11 | namespace Scintilla { 12 | 13 | struct StyleAndColour { 14 | int style; 15 | ColourDesired fore; 16 | StyleAndColour() noexcept : style(INDIC_PLAIN), fore(0, 0, 0) { 17 | } 18 | StyleAndColour(int style_, ColourDesired fore_ = ColourDesired(0, 0, 0)) noexcept : style(style_), fore(fore_) { 19 | } 20 | bool operator==(const StyleAndColour &other) const noexcept { 21 | return (style == other.style) && (fore == other.fore); 22 | } 23 | }; 24 | 25 | /** 26 | */ 27 | class Indicator { 28 | public: 29 | enum DrawState { drawNormal, drawHover }; 30 | StyleAndColour sacNormal; 31 | StyleAndColour sacHover; 32 | bool under; 33 | int fillAlpha; 34 | int outlineAlpha; 35 | int attributes; 36 | Indicator() noexcept : under(false), fillAlpha(30), outlineAlpha(50), attributes(0) { 37 | } 38 | Indicator(int style_, ColourDesired fore_=ColourDesired(0,0,0), bool under_=false, int fillAlpha_=30, int outlineAlpha_=50) noexcept : 39 | sacNormal(style_, fore_), sacHover(style_, fore_), under(under_), fillAlpha(fillAlpha_), outlineAlpha(outlineAlpha_), attributes(0) { 40 | } 41 | void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine, const PRectangle &rcCharacter, DrawState drawState, int value) const; 42 | bool IsDynamic() const noexcept { 43 | return !(sacNormal == sacHover); 44 | } 45 | bool OverridesTextFore() const noexcept { 46 | return sacNormal.style == INDIC_TEXTFORE || sacHover.style == INDIC_TEXTFORE; 47 | } 48 | int Flags() const noexcept { 49 | return attributes; 50 | } 51 | void SetFlags(int attributes_); 52 | }; 53 | 54 | } 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/script_interface/Gdi.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "Gdi.h" 3 | #include "helpers.h" 4 | 5 | Gdi::Gdi() {} 6 | Gdi::~Gdi() {} 7 | 8 | STDMETHODIMP Gdi::CreateImage(int w, int h, IGdiBitmap** pp) 9 | { 10 | if (!pp) return E_POINTER; 11 | 12 | *pp = nullptr; 13 | auto img = new Gdiplus::Bitmap(w, h, PixelFormat32bppPARGB); 14 | if (helpers::ensure_gdiplus_object(img)) 15 | { 16 | *pp = new com_object_impl_t(img); 17 | } 18 | else 19 | { 20 | if (img) delete img; 21 | img = nullptr; 22 | } 23 | 24 | return S_OK; 25 | } 26 | 27 | STDMETHODIMP Gdi::Font(BSTR name, float pxSize, int style, IGdiFont** pp) 28 | { 29 | if (!pp) return E_POINTER; 30 | 31 | *pp = nullptr; 32 | auto font = new Gdiplus::Font(name, pxSize, style, Gdiplus::UnitPixel); 33 | if (helpers::ensure_gdiplus_object(font)) 34 | { 35 | const HFONT hFont = CreateFont( 36 | -static_cast(pxSize), 37 | 0, 38 | 0, 39 | 0, 40 | (style & Gdiplus::FontStyleBold) ? FW_BOLD : FW_NORMAL, 41 | (style & Gdiplus::FontStyleItalic) ? TRUE : FALSE, 42 | (style & Gdiplus::FontStyleUnderline) ? TRUE : FALSE, 43 | (style & Gdiplus::FontStyleStrikeout) ? TRUE : FALSE, 44 | DEFAULT_CHARSET, 45 | OUT_DEFAULT_PRECIS, 46 | CLIP_DEFAULT_PRECIS, 47 | DEFAULT_QUALITY, 48 | DEFAULT_PITCH | FF_DONTCARE, 49 | name); 50 | *pp = new com_object_impl_t(font, hFont); 51 | } 52 | else 53 | { 54 | if (font) delete font; 55 | font = nullptr; 56 | } 57 | 58 | return S_OK; 59 | } 60 | 61 | STDMETHODIMP Gdi::Image(BSTR path, IGdiBitmap** pp) 62 | { 63 | if (!pp) return E_POINTER; 64 | 65 | *pp = helpers::load_image(path); 66 | return S_OK; 67 | } 68 | 69 | STDMETHODIMP Gdi::LoadImageAsync(UINT window_id, BSTR path, UINT* p) 70 | { 71 | if (!p) return E_POINTER; 72 | 73 | auto task = new helpers::load_image_async(reinterpret_cast(window_id), path); 74 | simple_thread_pool::instance().enqueue(task); 75 | 76 | *p = reinterpret_cast(task); 77 | return S_OK; 78 | } 79 | -------------------------------------------------------------------------------- /scintilla/src/LineMarker.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file LineMarker.h 3 | ** Defines the look of a line marker in the margin . 4 | **/ 5 | // Copyright 1998-2011 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef LINEMARKER_H 9 | #define LINEMARKER_H 10 | 11 | namespace Scintilla { 12 | 13 | class XPM; 14 | class RGBAImage; 15 | 16 | typedef void (*DrawLineMarkerFn)(Surface *surface, PRectangle &rcWhole, Font &fontForCharacter, int tFold, int marginStyle, const void *lineMarker); 17 | 18 | /** 19 | */ 20 | class LineMarker { 21 | public: 22 | enum typeOfFold { undefined, head, body, tail, headWithTail }; 23 | 24 | int markType = SC_MARK_CIRCLE; 25 | ColourDesired fore = ColourDesired(0, 0, 0); 26 | ColourDesired back = ColourDesired(0xff, 0xff, 0xff); 27 | ColourDesired backSelected = ColourDesired(0xff, 0x00, 0x00); 28 | int alpha = SC_ALPHA_NOALPHA; 29 | std::unique_ptr pxpm; 30 | std::unique_ptr image; 31 | /** Some platforms, notably PLAT_CURSES, do not support Scintilla's native 32 | * Draw function for drawing line markers. Allow those platforms to override 33 | * it instead of creating a new method(s) in the Surface class that existing 34 | * platforms must implement as empty. */ 35 | DrawLineMarkerFn customDraw = nullptr; 36 | 37 | LineMarker() noexcept = default; 38 | LineMarker(const LineMarker &other); 39 | LineMarker(LineMarker &&) noexcept = default; 40 | LineMarker &operator=(const LineMarker& other); 41 | LineMarker &operator=(LineMarker&&) noexcept = default; 42 | virtual ~LineMarker() = default; 43 | 44 | void SetXPM(const char *textForm); 45 | void SetXPM(const char *const *linesForm); 46 | void SetRGBAImage(Point sizeRGBAImage, float scale, const unsigned char *pixelsRGBAImage); 47 | void Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharacter, typeOfFold tFold, int marginStyle) const; 48 | }; 49 | 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /scintilla/src/CaseFolder.cxx: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file CaseFolder.cxx 3 | ** Classes for case folding. 4 | **/ 5 | // Copyright 1998-2013 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #include "CaseFolder.h" 13 | #include "CaseConvert.h" 14 | 15 | using namespace Scintilla; 16 | 17 | CaseFolder::~CaseFolder() { 18 | } 19 | 20 | CaseFolderTable::CaseFolderTable() : mapping{} { 21 | for (size_t iChar=0; iChar(iChar); 23 | } 24 | } 25 | 26 | CaseFolderTable::~CaseFolderTable() { 27 | } 28 | 29 | size_t CaseFolderTable::Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) { 30 | if (lenMixed > sizeFolded) { 31 | return 0; 32 | } else { 33 | for (size_t i=0; i(mixed[i])]; 35 | } 36 | return lenMixed; 37 | } 38 | } 39 | 40 | void CaseFolderTable::SetTranslation(char ch, char chTranslation) { 41 | mapping[static_cast(ch)] = chTranslation; 42 | } 43 | 44 | void CaseFolderTable::StandardASCII() noexcept { 45 | for (size_t iChar=0; iChar= 'A' && iChar <= 'Z') { 47 | mapping[iChar] = static_cast(iChar - 'A' + 'a'); 48 | } else { 49 | mapping[iChar] = static_cast(iChar); 50 | } 51 | } 52 | } 53 | 54 | CaseFolderUnicode::CaseFolderUnicode() { 55 | StandardASCII(); 56 | converter = ConverterFor(CaseConversionFold); 57 | } 58 | 59 | size_t CaseFolderUnicode::Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) { 60 | if ((lenMixed == 1) && (sizeFolded > 0)) { 61 | folded[0] = mapping[static_cast(mixed[0])]; 62 | return 1; 63 | } else { 64 | return converter->CaseConvertString(folded, sizeFolded, mixed, lenMixed); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /scintilla/src/RESearch.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file RESearch.h 3 | ** Interface to the regular expression search library. 4 | **/ 5 | // Written by Neil Hodgson 6 | // Based on the work of Ozan S. Yigit. 7 | // This file is in the public domain. 8 | 9 | #ifndef RESEARCH_H 10 | #define RESEARCH_H 11 | 12 | namespace Scintilla { 13 | 14 | class CharacterIndexer { 15 | public: 16 | virtual char CharAt(Sci::Position index) const=0; 17 | virtual ~CharacterIndexer() { 18 | } 19 | }; 20 | 21 | class RESearch { 22 | 23 | public: 24 | explicit RESearch(CharClassify *charClassTable); 25 | // No dynamic allocation so default copy constructor and assignment operator are OK. 26 | ~RESearch(); 27 | void Clear(); 28 | void GrabMatches(const CharacterIndexer &ci); 29 | const char *Compile(const char *pattern, Sci::Position length, bool caseSensitive, bool posix); 30 | int Execute(const CharacterIndexer &ci, Sci::Position lp, Sci::Position endp); 31 | 32 | enum { MAXTAG=10 }; 33 | enum { NOTFOUND=-1 }; 34 | 35 | Sci::Position bopat[MAXTAG]; 36 | Sci::Position eopat[MAXTAG]; 37 | std::string pat[MAXTAG]; 38 | 39 | private: 40 | 41 | enum { MAXNFA = 4096 }; 42 | // The following enums are not meant to be changeable. 43 | // They are for readability only. 44 | enum { MAXCHR = 256 }; 45 | enum { CHRBIT = 8 }; 46 | enum { BITBLK = MAXCHR / CHRBIT }; 47 | 48 | void ChSet(unsigned char c); 49 | void ChSetWithCase(unsigned char c, bool caseSensitive); 50 | int GetBackslashExpression(const char *pattern, int &incr); 51 | 52 | Sci::Position PMatch(const CharacterIndexer &ci, Sci::Position lp, Sci::Position endp, char *ap); 53 | 54 | Sci::Position bol; 55 | Sci::Position tagstk[MAXTAG]; /* subpat tag stack */ 56 | char nfa[MAXNFA]; /* automaton */ 57 | int sta; 58 | unsigned char bittab[BITBLK]; /* bit table for CCL pre-set bits */ 59 | int failure; 60 | CharClassify *charClass; 61 | bool iswordc(unsigned char x) const { 62 | return charClass->IsWord(x); 63 | } 64 | }; 65 | 66 | } 67 | 68 | #endif 69 | 70 | -------------------------------------------------------------------------------- /component/samples/complete/js/volume.js: -------------------------------------------------------------------------------- 1 | _.mixin({ 2 | volume : function (x, y, w, h) { 3 | this.volume_change = function () { 4 | window.RepaintRect(this.x, this.y, this.w, this.h); 5 | } 6 | 7 | this.trace = function (x, y) { 8 | var m = this.drag ? 200 : 0; 9 | return x > this.x - m && x < this.x + this.w + (m * 2) && y > this.y - m && y < this.y + this.h + (m * 2); 10 | } 11 | 12 | this.wheel = function (s) { 13 | if (this.trace(this.mx, this.my)) { 14 | if (s == 1) { 15 | fb.VolumeUp(); 16 | } else { 17 | fb.VolumeDown(); 18 | } 19 | _.tt(''); 20 | return true; 21 | } else { 22 | return false; 23 | } 24 | } 25 | 26 | this.move = function (x, y) { 27 | this.mx = x; 28 | this.my = y; 29 | if (this.trace(x, y)) { 30 | x -= this.x; 31 | var pos = x < 0 ? 0 : x > this.w ? 1 : x / this.w; 32 | this.drag_vol = Math.max(-100, 10 * Math.log(pos) / Math.LN2); 33 | _.tt(this.drag_vol.toFixed(2) + ' dB'); 34 | if (this.drag) { 35 | fb.Volume = this.drag_vol; 36 | } 37 | this.hover = true; 38 | return true; 39 | } else { 40 | if (this.hover) { 41 | _.tt(''); 42 | } 43 | this.hover = false; 44 | this.drag = false; 45 | return false; 46 | } 47 | } 48 | 49 | this.lbtn_down = function (x, y) { 50 | if (this.trace(x, y)) { 51 | this.drag = true; 52 | return true; 53 | } else { 54 | return false; 55 | } 56 | } 57 | 58 | this.lbtn_up = function (x, y) { 59 | if (this.trace(x, y)) { 60 | if (this.drag) { 61 | this.drag = false; 62 | fb.Volume = this.drag_vol; 63 | } 64 | return true; 65 | } else { 66 | return false; 67 | } 68 | } 69 | 70 | this.pos = function (type) { 71 | return Math.ceil((type == 'h' ? this.h : this.w) * Math.pow(2, fb.Volume / 10)); 72 | } 73 | 74 | this.x = x; 75 | this.y = y; 76 | this.w = w; 77 | this.h = h; 78 | this.mx = 0; 79 | this.my = 0; 80 | this.hover = false; 81 | this.drag = false; 82 | this.drag_vol = 0; 83 | } 84 | }); 85 | -------------------------------------------------------------------------------- /component/samples/js-smooth/JS Smooth Browser.txt: -------------------------------------------------------------------------------- 1 | // ==PREPROCESSOR== 2 | // @name "JS Smooth Browser" 3 | // @version "2018-mod" 4 | // @author "Br3tt aka Falstaff" 5 | // @import "%fb2k_component_path%samples\js-smooth\js\JScommon.js" 6 | // @import "%fb2k_component_path%samples\js-smooth\js\JSinputbox.js" 7 | // @import "%fb2k_component_path%samples\js-smooth\js\jssb.js" 8 | // ==/PREPROCESSOR== 9 | 10 | /* 11 | [Features] 12 | * 2 sources possible: library or active playlist (initialy designed as a library browser) 13 | * 3 columns modes available: albums, artists, genres 14 | * 4 display modes avaliable: column, art+bottom label, art+right label, grid art view 15 | * True Smooth Scrolling 16 | * Screen Touch support 17 | * Header bar at Top (can be hidden with CTRL+T) 18 | * Vertical Scrollbar (can be hidden with CTRL+B) 19 | * Filter box 20 | * Custom or Cover art Wallpaper as background supported (including a blur effect) 21 | * Windows scaling compliant (you can adjust zoom size in real time with CTRL+mousewheel) 22 | * Custom Panel Colors (in Properties window) 23 | * ... and more! 24 | 25 | [Tips] 26 | * for the ARTIST column mode, to make the disk cache working, artist images path have to be set in window Properties (SHIFT + right click > Properties) 27 | * Hold SHIFT key + right click to display Configure script and panel Properties entries 28 | * Change colors and fonts in foobar2000 Preferences > DefaultUI or ColumsUI 29 | * Some minor settings can be changed in window Properties (SHIFT + right click > Properties), use it carefully 30 | * Use Keyboard for "jumping" to an artist/genre in the library view (incremental search feature like in ELPlaylist) 31 | * Right Click on items for contextual menu for the selection 32 | * CTRL+T to toggle the columns toolbar 33 | * CTRL+B to toggle the scrollbar 34 | * Hold CTRL + Mouse Wheel to scale elements (useful for 'retina' screens) 35 | * Hold SHIFT + Mouse Wheel to scale group header and so the cover art size 36 | * F3 key to show now playing track (if present in library and not filtered) 37 | * F5 key to refresh covers 38 | * ... etc 39 | */ 40 | -------------------------------------------------------------------------------- /src/ui/ui_find_replace.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "editor_ctrl.h" 3 | 4 | class CDialogFindReplace : public CDialogImpl 5 | { 6 | public: 7 | CDialogFindReplace(CScriptEditorCtrl* parent); 8 | 9 | BEGIN_MSG_MAP_EX(CDialogFindReplace) 10 | MSG_WM_INITDIALOG(OnInitDialog) 11 | COMMAND_ID_HANDLER_EX(IDC_BTN_NEXT, OnFindNext) 12 | COMMAND_ID_HANDLER_EX(IDC_BTN_PREVIOUS, OnFindPrevious) 13 | COMMAND_ID_HANDLER_EX(IDCANCEL, OnCancel) 14 | COMMAND_ID_HANDLER_EX(IDC_BTN_REPLACE, OnReplace) 15 | COMMAND_ID_HANDLER_EX(IDC_BTN_REPLACE_ALL, OnReplaceAll) 16 | COMMAND_HANDLER_EX(IDC_EDIT_FIND, EN_CHANGE, OnFindTextChange) 17 | COMMAND_HANDLER_EX(IDC_EDIT_REPLACE, EN_CHANGE, OnReplaceTextChange) 18 | COMMAND_RANGE_HANDLER_EX(IDC_CHECK_MATCHCASE, IDC_CHECK_REGEXP, OnFlagCommand) 19 | END_MSG_MAP() 20 | 21 | enum { IDD = IDD_DIALOG_FIND_REPLACE }; 22 | 23 | enum class mode 24 | { 25 | find, 26 | replace 27 | }; 28 | 29 | BOOL OnInitDialog(CWindow, LPARAM); 30 | void OnCancel(UINT, int, CWindow); 31 | void OnFindNext(UINT, int, CWindow); 32 | void OnFindPrevious(UINT, int, CWindow); 33 | void OnFindTextChange(UINT, int, CWindow); 34 | void OnFlagCommand(UINT, int nID, CWindow); 35 | void OnReplace(UINT, int, CWindow); 36 | void OnReplaceAll(UINT, int, CWindow); 37 | void OnReplaceTextChange(UINT, int, CWindow); 38 | void SetMode(mode m); 39 | 40 | int m_flags = 0; 41 | pfc::string8_fast m_find_text, m_replace_text; 42 | 43 | private: 44 | class KeyHack : public CWindowImpl 45 | { 46 | public: 47 | KeyHack(); 48 | 49 | BEGIN_MSG_MAP_EX(KeyHack) 50 | MESSAGE_HANDLER(WM_CHAR, OnChar) 51 | MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown) 52 | END_MSG_MAP() 53 | 54 | BOOL SubclassWindow(CWindow hwnd, int cmd); 55 | LRESULT OnChar(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 56 | LRESULT OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 57 | 58 | private: 59 | int m_cmd = 0; 60 | }; 61 | 62 | bool m_havefound = false; 63 | CScriptEditorCtrl* m_parent; 64 | std::map m_window; 65 | std::vector m_hacks; 66 | }; 67 | -------------------------------------------------------------------------------- /docs/foo_jscript_panel.md: -------------------------------------------------------------------------------- 1 | ## JScript Panel 2 | 3 | [![GitHub stars](https://img.shields.io/github/stars/kbuffington/foo_jscript_panel?style=social)](https://github.com/kbuffington/foo_jscript_panel) 4 | 5 | ### Download 6 | 7 | [https://github.com/kbuffington/foo_jscript_panel/releases](https://github.com/kbuffington/foo_jscript_panel/releases) 8 | 9 | ### Minimum requirements 10 | 11 | `Windows XP SP3` and [foobar2000](https://foobar2000.org) `v1.4`. 12 | 13 | Both `Default UI` and [Columns UI](https://yuo.be/columns-ui) are supported. 14 | 15 | ### Installation 16 | 17 | [https://wiki.hydrogenaud.io/index.php?title=Foobar2000:How_to_install_a_component](https://wiki.hydrogenaud.io/index.php?title=Foobar2000:How_to_install_a_component) 18 | 19 | It is assumed you know how to add panels to your layout. Basic guides can be found below. 20 | 21 | [Default UI](http://wiki.hydrogenaud.io/index.php?title=Foobar2000:Layout_Editing_Mode) 22 | 23 | [Columns UI](https://wiki.yuo.be/columns_ui:config:layout) 24 | 25 | ### Samples 26 | 27 | Since the learning curve for writing your own scripts is quite steep, there are many included samples that don't require any knowledge at all. You simply pick the one you want to use from the `Samples` menu in the [Configuration Window](foo_jscript_panel/Configuration-Window.md). See the [Gallery](foo_jscript_panel/Gallery.md) for some screenshots. Further information about the included `Samples` and installing the required `fonts` can be found [here](foo_jscript_panel/Samples.md). 28 | 29 | ### Docs 30 | 31 | You can access these via the `Docs` menu in the [Configuration Window](foo_jscript_panel/Configuration-Window.md). 32 | 33 | ### More Info 34 | 35 | [Overview](foo_jscript_panel/Overview.md) 36 | 37 | [Breaking Changes](foo_jscript_panel/Breaking-Changes.md) 38 | 39 | [Configuration Window](foo_jscript_panel/Configuration-Window.md) 40 | 41 | [Editor Properties](foo_jscript_panel/Editor-Properties.md) 42 | 43 | [Old Versions](foo_jscript_panel/Old-Versions.md) 44 | 45 | [Playback Stats](foo_jscript_panel/Playback-Stats.md) 46 | 47 | [Drag and Drop](foo_jscript_panel/Drag-and-Drop.md) 48 | 49 | [WINE](foo_jscript_panel/WINE.md) 50 | -------------------------------------------------------------------------------- /component/samples/complete/listenbrainz.txt: -------------------------------------------------------------------------------- 1 | // ==PREPROCESSOR== 2 | // @name "Listenbrainz" 3 | // @author "marc2003" 4 | // @import "%fb2k_component_path%samples\complete\js\lodash.min.js" 5 | // @import "%fb2k_component_path%samples\complete\js\helpers.js" 6 | // @import "%fb2k_component_path%samples\complete\js\panel.js" 7 | // @import "%fb2k_component_path%samples\complete\js\listenbrainz.js" 8 | // ==/PREPROCESSOR== 9 | 10 | /* 11 | https://listenbrainz.org/ 12 | 13 | The button logo will remain grey and do nothing until your add 14 | your user token. Click the button to do this. When it changes 15 | to colour, "listens" are submitted after half the track has played 16 | or 4 minutes has passed (the same rules as Last.fm). Clicking the 17 | button will also reveal a few other options. 18 | 19 | If ListenBrainz is down or there are other connectivity issues, 20 | the script will cache any failed listens and try again the next time 21 | a listen is succesful. This happens automatically and cannot be triggered 22 | manually. Look out for all activity in the foobar2000 console via the View menu. 23 | 24 | Note that any listens that trigger a code 400 error from the listenbrainz server 25 | are malformed and cannot be retried. 26 | 27 | Please note that your token will be stored inside a plain text .ini file inside 28 | %appdata%\foobar2000\js_data\listenbrainz.ini (or inside the program folder itself if in portable mode) 29 | */ 30 | 31 | var panel = new _.panel('custom_background'); 32 | var buttons = new _.buttons(); 33 | var listenbrainz = new _.listenbrainz(2, 2, 16); 34 | 35 | function on_size() { 36 | panel.size(); 37 | } 38 | 39 | function on_paint(gr) { 40 | panel.paint(gr); 41 | buttons.paint(gr); 42 | } 43 | 44 | function on_playback_new_track(metadb) { 45 | listenbrainz.playback_new_track(metadb); 46 | } 47 | 48 | function on_playback_time() { 49 | listenbrainz.playback_time(); 50 | } 51 | 52 | function on_mouse_move(x, y) { 53 | buttons.move(x, y); 54 | } 55 | 56 | function on_mouse_leave() { 57 | buttons.leave(); 58 | } 59 | 60 | function on_mouse_lbtn_up(x, y) { 61 | buttons.lbtn_up(x, y); 62 | } 63 | 64 | function on_mouse_rbtn_up(x, y) { 65 | return panel.rbtn_up(x, y); 66 | } 67 | -------------------------------------------------------------------------------- /scintilla/lexlib/LexerNoExceptions.cxx: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file LexerNoExceptions.cxx 3 | ** A simple lexer with no state which does not throw exceptions so can be used in an external lexer. 4 | **/ 5 | // Copyright 1998-2010 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #include 9 | #include 10 | 11 | #include "ILexer.h" 12 | #include "Scintilla.h" 13 | #include "SciLexer.h" 14 | 15 | #include "PropSetSimple.h" 16 | #include "WordList.h" 17 | #include "LexAccessor.h" 18 | #include "Accessor.h" 19 | #include "LexerModule.h" 20 | #include "LexerBase.h" 21 | #include "LexerNoExceptions.h" 22 | 23 | using namespace Scintilla; 24 | 25 | Sci_Position SCI_METHOD LexerNoExceptions::PropertySet(const char *key, const char *val) { 26 | try { 27 | return LexerBase::PropertySet(key, val); 28 | } catch (...) { 29 | // Should not throw into caller as may be compiled with different compiler or options 30 | } 31 | return -1; 32 | } 33 | 34 | Sci_Position SCI_METHOD LexerNoExceptions::WordListSet(int n, const char *wl) { 35 | try { 36 | return LexerBase::WordListSet(n, wl); 37 | } catch (...) { 38 | // Should not throw into caller as may be compiled with different compiler or options 39 | } 40 | return -1; 41 | } 42 | 43 | void SCI_METHOD LexerNoExceptions::Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) { 44 | try { 45 | Accessor astyler(pAccess, &props); 46 | Lexer(startPos, lengthDoc, initStyle, pAccess, astyler); 47 | astyler.Flush(); 48 | } catch (...) { 49 | // Should not throw into caller as may be compiled with different compiler or options 50 | pAccess->SetErrorStatus(SC_STATUS_FAILURE); 51 | } 52 | } 53 | void SCI_METHOD LexerNoExceptions::Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) { 54 | try { 55 | Accessor astyler(pAccess, &props); 56 | Folder(startPos, lengthDoc, initStyle, pAccess, astyler); 57 | astyler.Flush(); 58 | } catch (...) { 59 | // Should not throw into caller as may be compiled with different compiler or options 60 | pAccess->SetErrorStatus(SC_STATUS_FAILURE); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /scintilla/src/EditModel.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file EditModel.h 3 | ** Defines the editor state that must be visible to EditorView. 4 | **/ 5 | // Copyright 1998-2014 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef EDITMODEL_H 9 | #define EDITMODEL_H 10 | 11 | namespace Scintilla { 12 | 13 | /** 14 | */ 15 | class Caret { 16 | public: 17 | bool active; 18 | bool on; 19 | int period; 20 | 21 | Caret(); 22 | }; 23 | 24 | class EditModel { 25 | public: 26 | bool inOverstrike; 27 | int xOffset; ///< Horizontal scrolled amount in pixels 28 | bool trackLineWidth; 29 | 30 | SpecialRepresentations reprs; 31 | Caret caret; 32 | SelectionPosition posDrag; 33 | Sci::Position braces[2]; 34 | int bracesMatchStyle; 35 | int highlightGuideColumn; 36 | Selection sel; 37 | bool primarySelection; 38 | 39 | enum IMEInteraction { imeWindowed, imeInline } imeInteraction; 40 | enum class CharacterSource { directInput, tentativeInput, imeResult }; 41 | enum class Bidirectional { bidiDisabled, bidiL2R, bidiR2L } bidirectional; 42 | 43 | int foldFlags; 44 | int foldDisplayTextStyle; 45 | UniqueString defaultFoldDisplayText; 46 | std::unique_ptr pcs; 47 | // Hotspot support 48 | Range hotspot; 49 | Sci::Position hoverIndicatorPos; 50 | 51 | // Wrapping support 52 | int wrapWidth; 53 | 54 | Document *pdoc; 55 | 56 | EditModel(); 57 | // Deleted so EditModel objects can not be copied. 58 | EditModel(const EditModel &) = delete; 59 | EditModel(EditModel &&) = delete; 60 | EditModel &operator=(const EditModel &) = delete; 61 | EditModel &operator=(EditModel &&) = delete; 62 | virtual ~EditModel(); 63 | virtual Sci::Line TopLineOfMain() const = 0; 64 | virtual Point GetVisibleOriginInMain() const = 0; 65 | virtual Sci::Line LinesOnScreen() const = 0; 66 | virtual Range GetHotSpotRange() const noexcept = 0; 67 | bool BidirectionalEnabled() const; 68 | bool BidirectionalR2L() const; 69 | void SetDefaultFoldDisplayText(const char *text); 70 | const char *GetDefaultFoldDisplayText() const noexcept; 71 | const char *GetFoldDisplayText(Sci::Line lineDoc) const; 72 | }; 73 | 74 | } 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /src/panel_window.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "drop_target_impl.h" 3 | #include "helpers.h" 4 | #include "panel_config.h" 5 | #include "script_host.h" 6 | 7 | class panel_window 8 | { 9 | public: 10 | virtual COLORREF get_colour_ui(size_t type) = 0; 11 | virtual IGdiFont* get_font_ui(size_t type) = 0; 12 | virtual void notify_size_limit_changed() = 0; 13 | 14 | public: 15 | struct size 16 | { 17 | void reset_min_max() 18 | { 19 | min.SetPoint(0, 0); 20 | max.SetPoint(INT_MAX, INT_MAX); 21 | } 22 | 23 | CPoint min, max; 24 | int height = 0; 25 | int width = 0; 26 | }; 27 | 28 | bool is_dui(); 29 | bool is_transparent(); 30 | panel_tooltip_param_ptr& panel_tooltip(); 31 | void repaint(); 32 | void repaint_rect(int x, int y, int w, int h); 33 | void script_invoke(callback_id id, VARIANTARG* argv = nullptr, size_t argc = 0, VARIANT* ret = nullptr) const; 34 | void show_configure_popup(HWND parent); 35 | void show_property_popup(HWND parent); 36 | void unload_script(); 37 | void update_script(); 38 | 39 | CWindow m_hwnd = nullptr; 40 | bool m_dragdrop = false; 41 | bool m_grabfocus = false; 42 | bool m_supports_transparency = false; 43 | panel_config m_panel_config{}; 44 | script_host* m_script_host; 45 | size m_size{}; 46 | 47 | protected: 48 | panel_window(); 49 | virtual ~panel_window(); 50 | 51 | enum class instance_type 52 | { 53 | cui, 54 | dui, 55 | }; 56 | 57 | bool handle_message(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp); 58 | void build_context_menu(HMENU menu, int id_base); 59 | void execute_context_menu_command(int id, int id_base); 60 | void on_context_menu(LPARAM lp); 61 | 62 | HDC m_hdc = nullptr; 63 | instance_type m_instance_type = instance_type::cui; 64 | 65 | private: 66 | void create_context(); 67 | void delete_context(); 68 | void load_script(); 69 | void on_paint(); 70 | void on_size(); 71 | void refresh_background(); 72 | void redraw(bool refreshbk); 73 | 74 | CComPtr m_drop_target; 75 | HBITMAP m_gr_bmp = nullptr; 76 | HBITMAP m_gr_bmp_bk = nullptr; 77 | IGdiGraphicsPtr m_gr_wrap; 78 | bool m_is_mouse_tracked = false; 79 | bool m_refreshbk = true; 80 | panel_tooltip_param_ptr m_panel_tooltip_param_ptr; 81 | ui_selection_holder::ptr m_selection_holder; 82 | }; 83 | -------------------------------------------------------------------------------- /src/script_interface/MetadbHandleList.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "script_interface.h" 3 | 4 | class MetadbHandleList : public IDisposableImpl4 5 | { 6 | protected: 7 | MetadbHandleList(metadb_handle_list_cref handles); 8 | ~MetadbHandleList(); 9 | 10 | void FinalRelease() override; 11 | 12 | metadb_handle_list m_handles; 13 | 14 | public: 15 | STDMETHODIMP get__ptr(void** pp) override; 16 | STDMETHODIMP Add(IMetadbHandle* handle) override; 17 | STDMETHODIMP AddRange(IMetadbHandleList* handles) override; 18 | STDMETHODIMP AttachImage(BSTR path, UINT art_id) override; 19 | STDMETHODIMP BSearch(IMetadbHandle* handle, int* p) override; 20 | STDMETHODIMP CalcTotalDuration(double* p) override; 21 | STDMETHODIMP CalcTotalSize(__int64* p) override; 22 | STDMETHODIMP Clone(IMetadbHandleList** pp) override; 23 | STDMETHODIMP Convert(VARIANT* p) override; 24 | STDMETHODIMP Find(IMetadbHandle* handle, int* p) override; 25 | STDMETHODIMP GetLibraryRelativePaths(VARIANT* p) override; 26 | STDMETHODIMP Insert(UINT index, IMetadbHandle* handle) override; 27 | STDMETHODIMP InsertRange(UINT index, IMetadbHandleList* handles) override; 28 | STDMETHODIMP MakeDifference(IMetadbHandleList* handles) override; 29 | STDMETHODIMP MakeIntersection(IMetadbHandleList* handles) override; 30 | STDMETHODIMP MakeUnion(IMetadbHandleList* handles) override; 31 | STDMETHODIMP OptimiseFileLayout(VARIANT_BOOL minimise) override; 32 | STDMETHODIMP OrderByFormat(__interface ITitleFormat* script, int direction) override; 33 | STDMETHODIMP OrderByPath() override; 34 | STDMETHODIMP OrderByRelativePath() override; 35 | STDMETHODIMP RefreshStats() override; 36 | STDMETHODIMP Remove(IMetadbHandle* handle) override; 37 | STDMETHODIMP RemoveAll() override; 38 | STDMETHODIMP RemoveAttachedImage(UINT art_id) override; 39 | STDMETHODIMP RemoveAttachedImages() override; 40 | STDMETHODIMP RemoveById(UINT index) override; 41 | STDMETHODIMP RemoveRange(UINT from, UINT count) override; 42 | STDMETHODIMP Sort() override; 43 | STDMETHODIMP UpdateFileInfoFromJSON(BSTR str) override; 44 | STDMETHODIMP get_Count(UINT* p) override; 45 | STDMETHODIMP get_Item(UINT index, IMetadbHandle** pp) override; 46 | STDMETHODIMP put_Item(UINT index, IMetadbHandle* handle) override; 47 | }; 48 | -------------------------------------------------------------------------------- /scintilla/src/ExternalLexer.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file ExternalLexer.h 3 | ** Support external lexers in DLLs or shared libraries. 4 | **/ 5 | // Copyright 2001 Simon Steele , portions copyright Neil Hodgson. 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef EXTERNALLEXER_H 9 | #define EXTERNALLEXER_H 10 | 11 | #if PLAT_WIN 12 | #define EXT_LEXER_DECL __stdcall 13 | #else 14 | #define EXT_LEXER_DECL 15 | #endif 16 | 17 | namespace Scintilla { 18 | 19 | typedef int (EXT_LEXER_DECL *GetLexerCountFn)(); 20 | typedef void (EXT_LEXER_DECL *GetLexerNameFn)(unsigned int Index, char *name, int buflength); 21 | typedef LexerFactoryFunction(EXT_LEXER_DECL *GetLexerFactoryFunction)(unsigned int Index); 22 | 23 | /// Sub-class of LexerModule to use an external lexer. 24 | class ExternalLexerModule : public LexerModule { 25 | protected: 26 | GetLexerFactoryFunction fneFactory; 27 | std::string name; 28 | public: 29 | ExternalLexerModule(int language_, LexerFunction fnLexer_, 30 | const char *languageName_=nullptr, LexerFunction fnFolder_=nullptr) : 31 | LexerModule(language_, fnLexer_, nullptr, fnFolder_), 32 | fneFactory(nullptr), name(languageName_){ 33 | languageName = name.c_str(); 34 | } 35 | virtual void SetExternal(GetLexerFactoryFunction fFactory, int index); 36 | }; 37 | 38 | /// LexerLibrary exists for every External Lexer DLL, contains ExternalLexerModules. 39 | class LexerLibrary { 40 | std::unique_ptr lib; 41 | std::vector> modules; 42 | public: 43 | explicit LexerLibrary(const char *moduleName_); 44 | ~LexerLibrary(); 45 | 46 | std::string moduleName; 47 | }; 48 | 49 | /// LexerManager manages external lexers, contains LexerLibrarys. 50 | class LexerManager { 51 | public: 52 | ~LexerManager(); 53 | 54 | static LexerManager *GetInstance(); 55 | static void DeleteInstance(); 56 | 57 | void Load(const char *path); 58 | void Clear(); 59 | 60 | private: 61 | LexerManager(); 62 | static std::unique_ptr theInstance; 63 | std::vector> libraries; 64 | }; 65 | 66 | class LMMinder { 67 | public: 68 | ~LMMinder(); 69 | }; 70 | 71 | } 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /src/script_interface/MenuObj.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "MenuObj.h" 3 | 4 | MenuObj::MenuObj(CWindow wnd_parent) : m_wnd_parent(wnd_parent) 5 | { 6 | m_hMenu = ::CreatePopupMenu(); 7 | } 8 | 9 | MenuObj::~MenuObj() {} 10 | 11 | void MenuObj::FinalRelease() 12 | { 13 | if (!m_has_detached && m_hMenu && IsMenu(m_hMenu)) 14 | { 15 | DestroyMenu(m_hMenu); 16 | m_hMenu = nullptr; 17 | } 18 | } 19 | 20 | STDMETHODIMP MenuObj::get__ID(HMENU* p) 21 | { 22 | if (!m_hMenu || !p) return E_POINTER; 23 | 24 | *p = m_hMenu; 25 | return S_OK; 26 | } 27 | 28 | STDMETHODIMP MenuObj::AppendMenuItem(UINT flags, UINT item_id, BSTR text) 29 | { 30 | if (!m_hMenu) return E_POINTER; 31 | if (flags & MF_POPUP || flags & MF_OWNERDRAW || flags & MF_BITMAP) return E_INVALIDARG; 32 | 33 | ::AppendMenu(m_hMenu, flags, item_id, text); 34 | return S_OK; 35 | } 36 | 37 | STDMETHODIMP MenuObj::AppendMenuSeparator() 38 | { 39 | if (!m_hMenu) return E_POINTER; 40 | 41 | ::AppendMenu(m_hMenu, MF_SEPARATOR, 0, 0); 42 | return S_OK; 43 | } 44 | 45 | STDMETHODIMP MenuObj::AppendTo(IMenuObj* parent, UINT flags, BSTR text) 46 | { 47 | if (!m_hMenu) return E_POINTER; 48 | 49 | MenuObj* pMenuParent = static_cast(parent); 50 | if (::AppendMenu(pMenuParent->m_hMenu, flags | MF_STRING | MF_POPUP, UINT_PTR(m_hMenu), text)) 51 | { 52 | m_has_detached = true; 53 | } 54 | return S_OK; 55 | } 56 | 57 | STDMETHODIMP MenuObj::CheckMenuItem(UINT item_id, VARIANT_BOOL check) 58 | { 59 | if (!m_hMenu) return E_POINTER; 60 | 61 | ::CheckMenuItem(m_hMenu, item_id, check != VARIANT_FALSE ? MF_CHECKED : MF_UNCHECKED); 62 | return S_OK; 63 | } 64 | 65 | STDMETHODIMP MenuObj::CheckMenuRadioItem(UINT first, UINT last, UINT selected) 66 | { 67 | if (!m_hMenu) return E_POINTER; 68 | 69 | ::CheckMenuRadioItem(m_hMenu, first, last, selected, MF_BYCOMMAND); 70 | return S_OK; 71 | } 72 | 73 | STDMETHODIMP MenuObj::TrackPopupMenu(int x, int y, UINT flags, UINT* p) 74 | { 75 | if (!m_hMenu || !p) return E_POINTER; 76 | 77 | flags |= TPM_NONOTIFY | TPM_RETURNCMD | TPM_RIGHTBUTTON; 78 | flags &= ~TPM_RECURSE; 79 | 80 | CPoint pt(x, y); 81 | m_wnd_parent.ClientToScreen(&pt); 82 | *p = ::TrackPopupMenu(m_hMenu, flags, pt.x, pt.y, 0, m_wnd_parent, nullptr); 83 | return S_OK; 84 | } 85 | -------------------------------------------------------------------------------- /src/drop_target_impl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | _COM_SMARTPTR_TYPEDEF(IDropTargetHelper, IID_IDropTargetHelper); 4 | 5 | class IDropTargetImpl : public IDropTarget 6 | { 7 | public: 8 | IDropTargetImpl(CWindow hwnd = nullptr) : m_hwnd(hwnd) 9 | { 10 | m_drop_target_helper.CreateInstance(CLSID_DragDropHelper, nullptr, CLSCTX_INPROC_SERVER); 11 | } 12 | 13 | virtual ~IDropTargetImpl() 14 | { 15 | RevokeDragDrop(); 16 | } 17 | 18 | virtual HRESULT OnDragEnter(IDataObject* pDataObj, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect) = 0; 19 | virtual HRESULT OnDragLeave() = 0; 20 | virtual HRESULT OnDragOver(DWORD grfKeyState, POINTL pt, DWORD* pdwEffect) = 0; 21 | virtual HRESULT OnDrop(IDataObject* pDataObj, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect) = 0; 22 | 23 | HRESULT RegisterDragDrop() 24 | { 25 | return ::RegisterDragDrop(m_hwnd, this); 26 | } 27 | 28 | HRESULT RevokeDragDrop() 29 | { 30 | return ::RevokeDragDrop(m_hwnd); 31 | } 32 | 33 | STDMETHODIMP DragEnter(IDataObject* pDataObj, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect) override 34 | { 35 | if (pDataObj == nullptr) return E_FAIL; 36 | if (pdwEffect == nullptr) return E_POINTER; 37 | 38 | CPoint point(pt.x, pt.y); 39 | m_drop_target_helper->DragEnter(m_hwnd, pDataObj, &point, *pdwEffect); 40 | return OnDragEnter(pDataObj, grfKeyState, pt, pdwEffect); 41 | } 42 | 43 | STDMETHODIMP DragLeave() override 44 | { 45 | m_drop_target_helper->DragLeave(); 46 | return OnDragLeave(); 47 | } 48 | 49 | STDMETHODIMP DragOver(DWORD grfKeyState, POINTL pt, DWORD* pdwEffect) override 50 | { 51 | if (pdwEffect == nullptr) return E_POINTER; 52 | 53 | CPoint point(pt.x, pt.y); 54 | m_drop_target_helper->DragOver(&point, *pdwEffect); 55 | return OnDragOver(grfKeyState, pt, pdwEffect); 56 | } 57 | 58 | STDMETHODIMP Drop(IDataObject* pDataObj, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect) override 59 | { 60 | if (pDataObj == nullptr) return E_FAIL; 61 | if (pdwEffect == nullptr) return E_POINTER; 62 | 63 | CPoint point(pt.x, pt.y); 64 | m_drop_target_helper->Drop(pDataObj, &point, *pdwEffect); 65 | return OnDrop(pDataObj, grfKeyState, pt, pdwEffect); 66 | } 67 | 68 | protected: 69 | CWindow m_hwnd = nullptr; 70 | IDropTargetHelperPtr m_drop_target_helper; 71 | }; 72 | -------------------------------------------------------------------------------- /scintilla/src/Decoration.h: -------------------------------------------------------------------------------- 1 | /** @file Decoration.h 2 | ** Visual elements added over text. 3 | **/ 4 | // Copyright 1998-2007 by Neil Hodgson 5 | // The License.txt file describes the conditions under which this software may be distributed. 6 | 7 | #ifndef DECORATION_H 8 | #define DECORATION_H 9 | 10 | namespace Scintilla { 11 | 12 | class IDecoration { 13 | public: 14 | virtual ~IDecoration() {} 15 | virtual bool Empty() const = 0; 16 | virtual int Indicator() const = 0; 17 | virtual Sci::Position Length() const = 0; 18 | virtual int ValueAt(Sci::Position position) const = 0; 19 | virtual Sci::Position StartRun(Sci::Position position) const = 0; 20 | virtual Sci::Position EndRun(Sci::Position position) const = 0; 21 | virtual void SetValueAt(Sci::Position position, int value) = 0; 22 | virtual void InsertSpace(Sci::Position position, Sci::Position insertLength) = 0; 23 | virtual Sci::Position Runs() const = 0; 24 | }; 25 | 26 | class IDecorationList { 27 | public: 28 | virtual ~IDecorationList() {} 29 | 30 | virtual const std::vector &View() const =0; 31 | 32 | virtual void SetCurrentIndicator(int indicator) = 0; 33 | virtual int GetCurrentIndicator() const = 0; 34 | 35 | virtual void SetCurrentValue(int value) = 0; 36 | virtual int GetCurrentValue() const = 0; 37 | 38 | // Returns with changed=true if some values may have changed 39 | virtual FillResult FillRange(Sci::Position position, int value, Sci::Position fillLength) = 0; 40 | virtual void InsertSpace(Sci::Position position, Sci::Position insertLength) = 0; 41 | virtual void DeleteRange(Sci::Position position, Sci::Position deleteLength) = 0; 42 | virtual void DeleteLexerDecorations() = 0; 43 | 44 | virtual int AllOnFor(Sci::Position position) const = 0; 45 | virtual int ValueAt(int indicator, Sci::Position position) = 0; 46 | virtual Sci::Position Start(int indicator, Sci::Position position) = 0; 47 | virtual Sci::Position End(int indicator, Sci::Position position) = 0; 48 | 49 | virtual bool ClickNotified() const = 0; 50 | virtual void SetClickNotified(bool notified) = 0; 51 | }; 52 | 53 | std::unique_ptr DecorationCreate(bool largeDocument, int indicator); 54 | 55 | std::unique_ptr DecorationListCreate(bool largeDocument); 56 | 57 | } 58 | 59 | #endif 60 | --------------------------------------------------------------------------------