/* main.cpp: parses options, runs slop, prints results. * * Copyright (C) 2014: Dalton Nell, Slop Contributors (https://github.com/naelstrof/slop/graphs/contributors). * * This file is part of Slop. * * Slop is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Slop is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Slop. If not, see . */ #include #include #include "slop.hpp" #include "options.hpp" using namespace slop; SlopOptions* getOptions( Options& options ) { SlopOptions* foo = new SlopOptions(); options.getFloat("bordersize", 'b', foo->borderSize); options.getFloat("padding", 'p', foo->padding); options.getFloat("tolerance", 't', foo->tolerance); glm::vec4 color = glm::vec4( foo->r, foo->g, foo->b, foo->a ); options.getColor("color", 'c', color); options.getBool("nokeyboard", 'k', foo->nokeyboard); options.getBool("noopengl", 'o', foo->noopengl); options.getString( "xdisplay", 'x', foo->xdisplay ); options.getString( "shader", 's', foo->shader ); foo->r = color.r; foo->g = color.g; foo->b = color.b; foo->a = color.a; options.getBool("highlight", 'l', foo->highlight); try { bool test = false; options.getBool("nodecorations", 'n', test); if ( test ) { foo->nodecorations = 1; } } catch( ... ) { options.getInt("nodecorations", 'n', foo->nodecorations); } return foo; } std::string formatOutput( std::string input, SlopSelection selection, bool cancelled ) { std::stringstream output; for( unsigned int i=0;iwhat() << "\n"; return 1; } // let the operating system handle any other kind of exception. return 1; }