From 7663637ea97bc8e06bfec36d19561bd0373c7070 Mon Sep 17 00:00:00 2001 From: Linus Dierheimer Date: Mon, 1 Nov 2021 19:33:12 +0100 Subject: [PATCH] Development notice --- DEVELOPMENT.md | 64 +++++++++++++++++++++++++++++++++++++++++++++++ src/common/logo.c | 3 +-- 2 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 DEVELOPMENT.md diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md new file mode 100644 index 000000000..f585fc872 --- /dev/null +++ b/DEVELOPMENT.md @@ -0,0 +1,64 @@ +# Development help + +This file is not an official documentation! +Here i just add things that are easy to forget. + +## Adding a logo + +Assuming foobar is the name of the logo: + +In `src/common/logo.c`: +* create method `initLogoFoobar(FFinstance* instance)`, at alphabetic ordered placement. Set the fields of `instance->logo`: + ```c + instance->config.logo.lines = + "$1Foo\n" + " $2bar"; + instance->config.logo.colors[0] = "\033[32m"; //green + instance->config.logo.colors[1] = "\033[35m"; //magenta + ``` +* go to method `loadLogoSet` and add an if at alphabetical position to load it: + ```c + else if(strcasecmp(logo, "foobar") == 0) + initLogoFoobar(instance); + ``` +* if different logos exist for different versions, differ betwenn them in `loadLogoSetWithVersion`: + ```c + [...] + + bool isFoobar = ffStrbufIgnCaseCompS(name, "foobar") == 0; + + if(versionID->length == 0 || ( + [...] && + !isFoobar + )) return loadLogoSet(instance, name->chars); + + [...] + + if(isFoobar) + { + if(version > 64) + return loadLogoSet(instance, "foobar"); + else + return loadLogoSet(instance, "foobar_old"); + } + ``` +* go to `ffPrintLogos` and at `FF_LOGO_PRINT` at alphabetical position: + ```c + FF_LOGO_PRINT(foobar, initLogoFoobar) + ``` + +In `src/data/logos.txt`: + +* Add the name of the logo at alphabetical position. + ``` + [...] + foobar + [...] + ``` + +In `README.md`: + +* Add the pretty name of the logo to the list of supported logos + ``` + [...] Foobar, [...] + ``` diff --git a/src/common/logo.c b/src/common/logo.c index 6ba6bb615..00f6af942 100644 --- a/src/common/logo.c +++ b/src/common/logo.c @@ -600,6 +600,7 @@ void ffPrintLogos(FFinstance* instance) FF_LOGO_PRINT(celos, initLogoCelOS) FF_LOGO_PRINT(debian, initLogoDebian) FF_LOGO_PRINT(fedora, initLogoFedora) + FF_LOGO_PRINT(fedora_old, initLogoFedoraOld) FF_LOGO_PRINT(garuda, initLogoGaruda) FF_LOGO_PRINT(gentoo, initLogoGentoo) FF_LOGO_PRINT(manjaro, initLogoManjaro) @@ -607,8 +608,6 @@ void ffPrintLogos(FFinstance* instance) FF_LOGO_PRINT(pop, initLogoPop) FF_LOGO_PRINT(ubuntu, initLogoUbuntu) FF_LOGO_PRINT(void, initLogoVoid) - - #undef FF_LOGO_PRINT } #endif