Commit c2e8a084 authored by Ziirish's avatar Ziirish

finishing the full parametrable symbols drawing

parent 55aaa7cf
......@@ -49,14 +49,16 @@ cid_focus_in(void *ptr)
cid->config->dAlpha += cid->runtime->dFocusVariation * FADE_VARIATION;
cid->runtime->dAnimationProgress = cid->config->dAlpha / (cid->runtime->dFocusVariation > 0 ?
cid->config->dFlyingColor[3]-cid->config->dColor[3] : cid->config->dColor[3]-cid->config->dFlyingColor[3]);
cid->config->pFlyingColor->dAlpha-cid->config->pColor->dAlpha :
cid->config->pColor->dAlpha-cid->config->pFlyingColor->dAlpha);
CID_REDRAW;
cid->runtime->iCurrentlyDrawing = 0;
cid->runtime->bFocusAnimation = cid->runtime->dFocusVariation>0 ?
cid->config->dAlpha < cid->config->dFlyingColor[3] : cid->config->dAlpha > cid->config->dFlyingColor[3];
cid->config->dAlpha < cid->config->pFlyingColor->dAlpha :
cid->config->dAlpha > cid->config->pFlyingColor->dAlpha;
if (!cid->runtime->bFocusAnimation)
cid_stop_measure_timer(pMeasureTimerFocus);
return cid->runtime->bFocusAnimation;
......@@ -71,21 +73,26 @@ cid_focus_out(void *ptr)
cid->runtime->bFocusAnimation = TRUE;
cid->config->dAlpha -= cid->runtime->dFocusVariation * FADE_VARIATION;
cid->runtime->dAnimationProgress = cid->config->dAlpha / (cid->runtime->dFocusVariation > 0 ?
cid->config->dFlyingColor[3]-cid->config->dColor[3] : cid->config->dColor[3]-cid->config->dFlyingColor[3]);
cid->runtime->dAnimationProgress =
cid->config->dAlpha / (cid->runtime->dFocusVariation > 0 ?
cid->config->pFlyingColor->dAlpha-cid->config->pColor->dAlpha :
cid->config->pColor->dAlpha-cid->config->pFlyingColor->dAlpha);
if (cid->runtime->dFocusVariation>0 ? cid->config->dAlpha <= cid->config->dColor[3] : cid->config->dAlpha >= cid->config->dColor[3])
if (cid->runtime->dFocusVariation>0 ?
cid->config->dAlpha <= cid->config->pColor->dAlpha :
cid->config->dAlpha >= cid->config->pColor->dAlpha)
{
cid->config->dRed = cid->config->dColor[0];
cid->config->dGreen = cid->config->dColor[1];
cid->config->dBlue = cid->config->dColor[2];
cid->config->dRed = cid->config->pColor->dRed;
cid->config->dGreen = cid->config->pColor->dGreen;
cid->config->dBlue = cid->config->pColor->dBlue;
}
CID_REDRAW;
cid->runtime->iCurrentlyDrawing = 0;
cid->runtime->bCurrentlyFlying = cid->runtime->dFocusVariation>0 ?
cid->config->dAlpha > cid->config->dColor[3] : cid->config->dAlpha < cid->config->dColor[3];
cid->config->dAlpha > cid->config->pColor->dAlpha :
cid->config->dAlpha < cid->config->pColor->dAlpha;
cid->runtime->bFocusAnimation = cid->runtime->bCurrentlyFlying;
if (!cid->runtime->bFocusAnimation)
cid_stop_measure_timer(pMeasureTimerFocus);
......@@ -108,9 +115,9 @@ cid_focus (GtkWidget *pWidget, GdkEventExpose *event, gpointer *userdata)
{
cid->runtime->bCurrentlyFlying = TRUE;
// On change la couleur du fond par celle choisie
cid->config->dRed = cid->config->dFlyingColor[0];
cid->config->dGreen = cid->config->dFlyingColor[1];
cid->config->dBlue = cid->config->dFlyingColor[2];
cid->config->dRed = cid->config->pFlyingColor->dRed;
cid->config->dGreen = cid->config->pFlyingColor->dGreen;
cid->config->dBlue = cid->config->pFlyingColor->dBlue;
// Coloration "smoothie"
cid_animation(CID_FOCUS_IN);
} else
......
This diff is collapsed.
......@@ -13,6 +13,19 @@
G_BEGIN_DECLS
/**
* Fonction permettant de recuperer une couleur dans un fichier de configuration.
* @param pCid Structure de configuration.
* @param pKeyFile Fichier de configuration.
* @param cGroup Groupe auquel appartient la cle recherchee.
* @param cKey Cle recherchee.
* @param bAlpha Si on a un canal alpha.
* @return La couleur correspondant aux criteres.
*/
CidColorContainer *cid_get_color_value_full (CidMainContainer **pCid, GKeyFile *pKeyFile, gchar *cGroup, gchar *cKey, gboolean bAlpha);
#define CID_CONFIG_GET_COLOR(cGroup,cKey) cid_get_color_value_full (pCid,cid->pKeyFile,cGroup,cKey, FALSE)
#define CID_CONFIG_GET_COLOR_WITH_ALPHA(cGroup,cKey) cid_get_color_value_full (pCid,cid->pKeyFile,cGroup,cKey,TRUE)
/**
* Fonction permettant de recuperer un boolean dans un fichier de configuration.
* @param pCid Structure de configuration.
......@@ -36,6 +49,7 @@ gboolean cid_get_boolean_value_full (CidMainContainer **pCid, GKeyFile *pKeyFile
* @param cDefault Valeur par defaut.
* @param bFile Si on veut tester l'existance d'un fichier.
* @param bDir Si on veut tester l'existance d'un dossier.
* @param bForce Si on souhaite forcer le resultat meme si le fichier/repertoire n'existe pas.
* @return La chaine correspondante aux criteres.
*/
gchar *cid_get_string_value_full (CidMainContainer **pCid, GKeyFile *pKeyFile, gchar *cGroup, gchar *cKey, gboolean bDefault, gchar *cDefault, gboolean bFile, gboolean bDir, gboolean bForce);
......
This diff is collapsed.
......@@ -302,13 +302,26 @@ struct _CidConfig {
GdkWindowTypeHint iHint;
/// couleur de la fenêtre
gdouble *dColor;
CidColorContainer *pColor;
/// couleur au survol
gdouble *dFlyingColor;
CidColorContainer *pFlyingColor;
/// couleur de police
gdouble *dPoliceColor;
CidColorContainer *pPoliceColor;
/// couleur de contour de police
gdouble *dOutlineTextColor;
CidColorContainer *pOutlineTextColor;
/// Couleur des symboles
CidColorContainer *pSymbolColor;
/// Couleur des symboles au survol
CidColorContainer *pFlyingSymbolColor;
/// couleur de la fenêtre
//gdouble *dColor;
/// couleur au survol
//gdouble *dFlyingColor;
/// couleur de police
//gdouble *dPoliceColor;
/// couleur de contour de police
//gdouble *dOutlineTextColor;
/// angle de cid
gdouble dRotate;
/// opacité de la fenêtre
......
......@@ -101,11 +101,18 @@ cid_free_main_structure (CidMainContainer *pCid)
cairo_surface_destroy(pCid->p_cPause_big);
if (pCid->p_cNext)
cairo_surface_destroy(pCid->p_cPrev);
if (pCid->config->cConfFile)
// if (pCid->config->cConfFile)
g_free(pCid->config->cConfFile);
if (pCid->config->cVerbosity)
// if (pCid->config->cVerbosity)
g_free(pCid->config->cVerbosity);
g_free (pCid->config->pColor);
g_free (pCid->config->pFlyingColor);
g_free (pCid->config->pPoliceColor);
g_free (pCid->config->pOutlineTextColor);
g_free (pCid->config->pSymbolColor);
g_free (pCid->config->pFlyingSymbolColor);
pCid->pWindow = NULL;
pCid->p_cSurface = NULL;
pCid->p_cPreviousSurface = NULL;
......@@ -164,41 +171,44 @@ cid_read_parameters (CidMainContainer **pCid, int *argc, char ***argv)
{
{"log", 'l', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING,
&cid->config->cVerbosity,
dgettext (CID_GETTEXT_PACKAGE, "log verbosity (debug,info,message,warning,error) default is warning."), NULL},
"log verbosity (debug,info,message,warning,error) default is warning.", NULL},
{"config", 'c', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_FILENAME,
&cConfFile,
dgettext (CID_GETTEXT_PACKAGE, "load CID with this config file instead of ~/.config/cid/cid.conf."), NULL},
"load CID with this config file instead of ~/.config/cid/cid.conf.", NULL},
{"testing", 'T', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE,
&bTestingMode,
dgettext (CID_GETTEXT_PACKAGE, "runs CID in testing mode. (some unstable options might be running)"), NULL},
"runs CID in testing mode. (some unstable options might be running)", NULL},
{"debug", 'd', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE,
&bDebugMode,
dgettext (CID_GETTEXT_PACKAGE, "runs CID in debug mode. (equivalent to '-l debug')"), NULL},
"runs CID in debug mode. (equivalent to '-l debug')", NULL},
{"edit", 'e', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE,
&bConfigPanel,
dgettext (CID_GETTEXT_PACKAGE, "open CID's configuration panel."), NULL},
"open CID's configuration panel.", NULL},
{"safe", 's', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE,
&bSafeMode,
dgettext (CID_GETTEXT_PACKAGE, "runs CID in safe mode."), NULL},
"runs CID in safe mode.", NULL},
{"cafe", 'C', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE,
&bCafe,
dgettext (CID_GETTEXT_PACKAGE, "do you want a cup of coffee?"), NULL},
"do you want a cup of coffee?", NULL},
{"version", 'v', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE,
&bPrintVersion,
dgettext (CID_GETTEXT_PACKAGE, "print version and quit."), NULL},
"print version and quit.", NULL},
{ NULL, 0, 0, 0, NULL, NULL, NULL }
};
GOptionContext *context = g_option_context_new ("");
g_option_context_set_summary (context,dgettext (CID_GETTEXT_PACKAGE, "Conky Images Display is a programm written in C.\n\
g_option_context_set_summary (context,"Conky Images Display is a programm written in C.\n\
Its goal is to display the cover of the song which \
is currently playing in the player you chooseon the \
desktop like conky does with other informations.\n\
You can use it with the following options:\n"));
You can use it with the following options:\n");
g_option_context_add_main_entries (context, entries, CID_GETTEXT_PACKAGE);
erreur = NULL;
if (!g_option_context_parse (context, argc, argv, &erreur))
{
cid_exit (&cid, CID_ERROR_READING_ARGS, "ERROR : %s\n", erreur->message);
fprintf (stderr, "ERROR: %s\n", erreur->message);
g_error_free (erreur);
exit (CID_ERROR_READING_ARGS);
}
if (bSafeMode)
......@@ -256,6 +266,8 @@ You can use it with the following options:\n"));
cid->config->cConfFile = g_strdup (cConfFile);
g_free (cConfFile);
}
g_option_context_free (context);
}
void
......
......@@ -218,9 +218,29 @@ main ( int argc, char **argv )
struct sigaction action;
cid = g_malloc0 (sizeof(*cid));
if (!cid)
{
fprintf (stderr, "Couldn't allocate memory for the main container!\n");
exit (CID_EXIT_ERROR);
}
cid->config = g_malloc0 (sizeof(*(cid->config)));
if (!cid->config)
{
fprintf (stderr, "Couldn't allocate memory for the configuration container!\n");
exit (CID_EXIT_ERROR);
}
cid->runtime = g_malloc0 (sizeof(*(cid->runtime)));
if (!cid->runtime)
{
fprintf (stderr, "Couldn't allocate memory for the runtime container!\n");
exit (CID_EXIT_ERROR);
}
cid->defaut = g_malloc0 (sizeof(*(cid->defaut)));
if (!cid->defaut)
{
fprintf (stderr, "Couldn't allocate memory for the default container!\n");
exit (CID_EXIT_ERROR);
}
curl_global_init(CURL_GLOBAL_ALL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment