int main(int argc, char **argv) { /* Declare vars. */ CDKSCREEN *cdkscreen = 0; CDKHISTOGRAM *volume = 0; CDKHISTOGRAM *bass = 0; CDKHISTOGRAM *treble = 0; WINDOW *cursesWin = 0; char *volumeTitle = "<C></5>Volume<!5>"; char *bassTitle = "<C></5>Bass <!5>"; char *trebleTitle = "<C></5>Treble<!5>"; CDK_PARAMS params; boolean Box; CDKparseParams(argc, argv, ¶ms, CDK_CLI_PARAMS); Box = CDKparamValue(¶ms, 'N', TRUE); /* Set up CDK. */ cursesWin = initscr(); cdkscreen = initCDKScreen (cursesWin); /* Start CDK Color. */ initCDKColor(); /* Create the histogram objects. */ volume = newCDKHistogram (cdkscreen, CDKparamValue(¶ms, 'X', 10), CDKparamValue(¶ms, 'Y', 10), CDKparamValue(¶ms, 'H', 1), CDKparamValue(¶ms, 'W', -2), HORIZONTAL, volumeTitle, Box, CDKparamValue(¶ms, 'S', FALSE)); if (volume == 0) { /* Exit CDK. */ destroyCDKScreen (cdkscreen); endCDK(); /* Print out a message and exit. */ printf ("Oops. Can not make volume histogram. Is the window big enough??\n"); ExitProgram (EXIT_FAILURE); } bass = newCDKHistogram (cdkscreen, CDKparamValue(¶ms, 'X', 10), CDKparamValue(¶ms, 'Y', 14), CDKparamValue(¶ms, 'H', 1), CDKparamValue(¶ms, 'W', -2), HORIZONTAL, bassTitle, Box, CDKparamValue(¶ms, 'S', FALSE)); if (bass == 0) { /* Exit CDK. */ destroyCDKHistogram (volume); destroyCDKScreen (cdkscreen); endCDK(); /* Print out a message and exit. */ printf ("Oops. Can not make bass histogram. Is the window big enough??\n"); ExitProgram (EXIT_FAILURE); } treble = newCDKHistogram (cdkscreen, CDKparamValue(¶ms, 'X', 10), CDKparamValue(¶ms, 'Y', 18), CDKparamValue(¶ms, 'H', 1), CDKparamValue(¶ms, 'W', -2), HORIZONTAL, trebleTitle, Box, CDKparamValue(¶ms, 'S', FALSE)); if (treble == 0) { /* Exit CDK. */ destroyCDKHistogram (volume); destroyCDKHistogram (bass); destroyCDKScreen (cdkscreen); endCDK(); /* Print out a message and exit. */ printf ("Oops. Can not make treble histogram. Is the window big enough??\n"); ExitProgram (EXIT_FAILURE); } #define BAR(a,b,c) A_BOLD, a, b, c, ' '|A_REVERSE|COLOR_PAIR(3), Box /* Set the histogram values. */ setCDKHistogram (volume, vPERCENT, CENTER, BAR(0, 10, 6)); setCDKHistogram (bass , vPERCENT, CENTER, BAR(0, 10, 3)); setCDKHistogram (treble, vPERCENT, CENTER, BAR(0, 10, 7)); refreshCDKScreen (cdkscreen); sleep (4); /* Set the histogram values. */ setCDKHistogram (volume, vPERCENT, CENTER, BAR(0, 10, 8)); setCDKHistogram (bass , vPERCENT, CENTER, BAR(0, 10, 1)); setCDKHistogram (treble, vPERCENT, CENTER, BAR(0, 10, 9)); refreshCDKScreen (cdkscreen); sleep (4); /* Set the histogram values. */ setCDKHistogram (volume, vPERCENT, CENTER, BAR(0, 10, 10)); setCDKHistogram (bass , vPERCENT, CENTER, BAR(0, 10, 7)); setCDKHistogram (treble, vPERCENT, CENTER, BAR(0, 10, 10)); refreshCDKScreen (cdkscreen); sleep (4); /* Set the histogram values. */ setCDKHistogram (volume, vPERCENT, CENTER, BAR(0, 10, 1)); setCDKHistogram (bass , vPERCENT, CENTER, BAR(0, 10, 8)); setCDKHistogram (treble, vPERCENT, CENTER, BAR(0, 10, 3)); refreshCDKScreen (cdkscreen); sleep (4); /* Set the histogram values. */ setCDKHistogram (volume, vPERCENT, CENTER, BAR(0, 10, 3)); setCDKHistogram (bass , vPERCENT, CENTER, BAR(0, 10, 3)); setCDKHistogram (treble, vPERCENT, CENTER, BAR(0, 10, 3)); refreshCDKScreen (cdkscreen); sleep (4); /* Set the histogram values. */ setCDKHistogram (volume, vPERCENT, CENTER, BAR(0, 10, 10)); setCDKHistogram (bass , vPERCENT, CENTER, BAR(0, 10, 10)); setCDKHistogram (treble, vPERCENT, CENTER, BAR(0, 10, 10)); refreshCDKScreen (cdkscreen); sleep (4); /* Clean up. */ destroyCDKHistogram (volume); destroyCDKHistogram (bass); destroyCDKHistogram (treble); destroyCDKScreen (cdkscreen); endCDK(); ExitProgram (EXIT_SUCCESS); }
void CCDKHistogram::SetHistogram(EHistogramDisplayType vtype, int statspos, int min, int max, int cur, chtype fillch, chtype statattr) { setCDKHistogram(m_pHistogram, vtype, statspos, statattr, min, max, cur, fillch, m_bBox); }