Better search bar

This commit is contained in:
Edouard Dupin 2012-07-03 16:59:22 +02:00
parent fee00e79c7
commit 10d0fb5674
7 changed files with 234 additions and 134 deletions

14
assets/icon/Down.svg Normal file
View File

@ -0,0 +1,14 @@
<svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="64" width="64" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/">
<metadata>
<rdf:RDF>
<cc:Work rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
<dc:title/>
</cc:Work>
</rdf:RDF>
</metadata>
<g transform="matrix(0,1.2,-1.2,0,631.9838,-722.6014)">
<polygon points="629.89,509.46,607.39,509.46,607.39,490.51,629.89,490.51,629.89,481.04,652.39,499.94,629.89,518.93" fill="#333"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 638 B

View File

@ -1,7 +1,60 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="64" height="64">
<g transform="matrix(1.2,0,0,1.2,-579.7324,-351.106)">
<path d="m 509.777,296.755 c -12.426,0 -22.5,10.073 -22.5,22.5 0,12.427 10.074,22.5 22.5,22.5 12.426,0 22.5,-10.073 22.5,-22.5 0,-12.427 -10.074,-22.5 -22.5,-22.5 z m 14.063,22.5 c 0,2.344 -0.584,4.55 -1.602,6.495 l -18.955,-18.955 c 1.945,-1.019 4.151,-1.603 6.494,-1.603 7.754,10e-4 14.063,6.309 14.063,14.063 z m -28.125,0 c 0,-2.343 0.584,-4.55 1.602,-6.493 l 18.955,18.953 c -1.943,1.019 -4.15,1.603 -6.494,1.603 -7.755,0 -14.063,-6.308 -14.063,-14.063 z"
style="fill:#333333" />
</g>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="64"
height="64"
id="svg3028"
version="1.1"
inkscape:version="0.48.3.1 r9886"
sodipodi:docname="Forbidden.svg">
<metadata
id="metadata3038">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs3036" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1340"
inkscape:window-height="892"
id="namedview3034"
showgrid="false"
inkscape:zoom="8"
inkscape:cx="52.794424"
inkscape:cy="15.718112"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="0"
inkscape:current-layer="svg3028" />
<g
transform="matrix(1.2,0,0,1.2,-579.7324,-351.106)"
id="g3030">
<path
d="m 532.27833,319.25811 c 0,-12.427 -10.07533,-22.50311 -22.50133,-22.50311 -12.426,0 -22.5,10.073 -22.5,22.5 0,12.427 10.074,22.5 22.5,22.5 l 0.021,-8.437 c -7.755,0 -14.08298,-6.308 -14.08298,-14.063 0,-2.343 0.584,-4.55 1.602,-6.493 l 18.955,18.953 c -1.943,1.019 -4.15,1.603 -6.494,1.603 l -0.001,8.45698 c 12.426,0 22.5,-10.09298 22.5,-22.51998 l -8.43744,5.9e-4 c 0,2.344 -0.58356,4.54941 -1.60156,6.49441 l -18.955,-18.955 c 1.945,-1.019 4.151,-1.603 6.494,-1.603 7.754,10e-4 14.063,6.309 14.063,14.063 z"
style="fill:#333333"
id="path3032"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cssccsccccccccccc" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 648 B

After

Width:  |  Height:  |  Size: 2.2 KiB

63
assets/icon/Remove2.svg Normal file
View File

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="64"
height="64"
id="svg3028"
version="1.1"
inkscape:version="0.48.3.1 r9886"
sodipodi:docname="Remove2.svg">
<metadata
id="metadata3038">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs3036" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1680"
inkscape:window-height="968"
id="namedview3034"
showgrid="true"
inkscape:zoom="9.0377085"
inkscape:cx="14.895958"
inkscape:cy="28.796248"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="svg3028">
<inkscape:grid
type="xygrid"
id="grid3040" />
</sodipodi:namedview>
<g
transform="matrix(1.2000267,0,0,1.2000267,-651.9777,-351.11481)"
id="g3030">
<path
d="m 576.63525,319.25524 15.35699,-15.27674 c 0.627,-0.627 0.627,-1.654 0,-2.281 l -4.29338,-4.3352 c -0.627,-0.625 -1.652,-0.625 -2.279,0 l -15.45113,15.22642 -15.83298,-15.45692 c -0.627,-0.625 -1.654,-0.625 -2.281,0 l -3.9859,4.00946 c -0.625,0.627 -0.625,1.654 0,2.281 l 15.43337,15.83298 -15.31612,15.67389 c -0.61972,0.63419 -0.627,1.654 0,2.281 l 4.14303,4.07587 c 0.627,0.625 1.654,0.625 2.281,0 l 15.5586,-15.36424 16.05393,15.36226 c 0.627,0.625 1.652,0.625 2.279,0 l 3.69434,-4.06095 c 0.627,-0.627 0.62038,-1.64745 0,-2.281 z"
style="fill:#fe0000;fill-opacity:0.88627452"
id="path3032"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccccccscccccccsc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -1,4 +1,61 @@
<svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="64" width="64" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/">
<path d="M58.168,50.56,46.013,38.407c-0.91442-0.91442-2.3016-1.0644-3.3865-0.47161l-2.592-2.592c2.208-3.1357,3.5185-6.9493,3.5185-11.068,0-10.629-8.6485-19.276-19.277-19.276-10.629,0-19.276,8.6461-19.276,19.276s8.6461,19.277,19.276,19.277c4.1017,0,7.8985-1.296,11.026-3.4873l2.6088,2.6112c-0.56041,1.0752-0.40321,2.4348,0.49681,3.3373l12.155,12.153c1.1088,1.1112,2.9268,1.1112,4.0357,0l3.5725-3.5701c1.1064-1.1088,1.1064-2.9256-0.0024-4.0369z" fill="#333"/>
<path fill="#FFF" d="M36.626,24.307c0.39,7.832-8.369,14.567-16.05,11.613-7.563-2.416-10.612-12.296-6.089-18.543,4.1285-6.8311,15.305-7.0806,19.727-0.41516,1.5717,2.1218,2.4162,4.7323,2.4118,7.3444z"/>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
height="64"
width="64"
version="1.1"
id="svg3965"
inkscape:version="0.48.3.1 r9886"
sodipodi:docname="Search.svg">
<metadata
id="metadata3975">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs3973" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1680"
inkscape:window-height="968"
id="namedview3971"
showgrid="false"
inkscape:zoom="16"
inkscape:cx="27.03623"
inkscape:cy="33.687368"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="svg3965" />
<path
d="M 39.436904,24.062448 C 39.915614,33.278293 29.16429,41.203307 19.736168,37.727362 10.452887,34.884476 6.7103607,23.258769 12.262163,15.90798 17.329733,7.8698857 31.048441,7.5763012 36.47627,15.419465 c 1.929199,2.496703 2.965789,5.568455 2.960389,8.64209 z"
id="path3969"
style="fill:#ffffff;fill-opacity:0.87450981"
inkscape:connector-curvature="0" />
<path
d="M 58.168,50.56 46.013,38.407 c -0.91442,-0.91442 -2.3016,-1.0644 -3.3865,-0.47161 l -2.592,-2.592 c 2.208,-3.1357 3.5185,-6.9493 3.5185,-11.068 0,-10.629 -8.6485,-19.276 -19.277,-19.276 -10.629,0 -19.276,8.6461 -19.276,19.276 0,10.6299 8.6461,19.277 19.276,19.277 4.1017,0 7.8985,-1.296 11.026,-3.4873 0,0 0.596082,-5.606306 -5.038478,-5.016691 -4.69706,2.902115 -12.054397,2.017375 -15.875086,-3.769003 -3.142722,-4.56604 -2.630816,-13.100523 2.668347,-16.731928 5.299163,-3.631405 14.142128,-3.981951 18.471312,4.363412 2.363082,6.040278 0.78609,12.603632 -5.311526,16.1632 7.665096,7.559567 7.694231,7.60221 7.694231,7.60221 -0.56041,1.0752 -0.40321,2.4348 0.49681,3.3373 l 12.155,12.153 c 1.1088,1.1112 2.9268,1.1112 4.0357,0 l 3.5725,-3.5701 c 1.1064,-1.1088 1.1064,-2.9256 -0.0024,-4.0369 z"
id="path3967"
inkscape:connector-curvature="0"
style="fill:#333333"
sodipodi:nodetypes="ccccssssccczccccccccc" />
</svg>

Before

Width:  |  Height:  |  Size: 888 B

After

Width:  |  Height:  |  Size: 2.7 KiB

14
assets/icon/Up.svg Normal file
View File

@ -0,0 +1,14 @@
<svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="64" width="64" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/">
<metadata>
<rdf:RDF>
<cc:Work rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
<dc:title/>
</cc:Work>
</rdf:RDF>
</metadata>
<g transform="matrix(0,-1.2,1.2,0,-567.9838,789.1274)">
<polygon points="652.39,499.94,629.89,518.93,629.89,509.46,607.39,509.46,607.39,490.51,629.89,490.51,629.89,481.04" fill="#333"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 638 B

View File

@ -68,8 +68,6 @@ Search::Search(void)
m_forward = false;
ewol::Entry * myEntry = NULL;
ewol::Button * myButton = NULL;
ewol::CheckBox * mycheckbox = NULL;
ewol::ButtonImage * myButtonImage = NULL;
myEntry = new ewol::Entry();
@ -95,29 +93,37 @@ Search::Search(void)
SubWidgetAdd(myButtonImage);
myButtonImage = new ewol::ButtonImage("icon/CaseSensitive.svg");
myButtonImage->SetImageSelected("icon/CaseSensitive.svg", 0xFFFFFF5F);
myButtonImage->SetMinSize(32,32);
myButtonImage->SetToggleMode(true);
myButtonImage->SetValue(SearchData::GetCase());
myButtonImage->RegisterOnEvent(this, ewolEventButtonPressed, l_eventCaseCb);
SubWidgetAdd(myButtonImage);
myButtonImage = new ewol::ButtonImage("icon/WrapAround.svg");
myButtonImage->SetImageSelected("icon/WrapAround.svg", 0xFFFFFF5F);
myButtonImage->SetMinSize(32,32);
myButtonImage->SetToggleMode(true);
myButtonImage->SetValue(SearchData::GetWrap());
myButtonImage->RegisterOnEvent(this, ewolEventButtonPressed, l_eventWrapCb);
SubWidgetAdd(myButtonImage);
mycheckbox = new ewol::CheckBox("Forward");
mycheckbox->RegisterOnEvent(this, ewolEventCheckBoxClicked, l_eventForwardCb);
SubWidgetAdd(mycheckbox);
myButtonImage = new ewol::ButtonImage("icon/Up.svg");
myButtonImage->SetImageSelected("icon/Down.svg");
myButtonImage->SetMinSize(32,32);
myButtonImage->SetToggleMode(true);
myButtonImage->SetValue(m_forward);
myButtonImage->RegisterOnEvent(this, ewolEventButtonPressed, l_eventForwardCb);
SubWidgetAdd(myButtonImage);
myButton = new ewol::Button("Hide");
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventHideBt);
SubWidgetAdd(myButton);
myButtonImage = new ewol::ButtonImage("icon/Forbidden.svg");
myButtonImage->SetMinSize(32,32);
myButtonImage->RegisterOnEvent(this, ewolEventButtonPressed, l_eventHideBt);
SubWidgetAdd(myButtonImage);
RegisterMultiCast(ednMsgGuiSearch);
RegisterMultiCast(ednMsgGuiReplace);
// basicly hiden ...
Hide();
}
Search::~Search(void)
@ -206,123 +212,14 @@ void Search::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId
m_forward = false;
}
} else if ( eventId == l_eventHideBt) {
}
}
/*
void Search::OnButtonPrevious(GtkWidget *widget, gpointer data)
{
//APPL_INFO("CALLBACK");
GeneralSendMessage(APPL_MSG__CURRENT_FIND_PREVIOUS);
}
void Search::OnButtonNext(GtkWidget *widget, gpointer data)
{
//APPL_INFO("CALLBACK");
GeneralSendMessage(APPL_MSG__CURRENT_FIND_NEXT);
}
void Search::OnButtonReplace(GtkWidget *widget, gpointer data)
{
//APPL_INFO("CALLBACK");
GeneralSendMessage(APPL_MSG__CURRENT_REPLACE);
}
void Search::OnButtonReplaceAndNext(GtkWidget *widget, gpointer data)
{
//APPL_INFO("CALLBACK");
GeneralSendMessage(APPL_MSG__CURRENT_REPLACE);
GeneralSendMessage(APPL_MSG__CURRENT_FIND_NEXT);
}
void Search::OnButtonQuit(GtkWidget *widget, gpointer data)
{
//APPL_INFO("CALLBACK");
Search * self = static_cast<Search*>(data);
self->Destroy();
}
void Search::OnCheckBoxEventWrap(GtkWidget *widget, gpointer data)
{
//APPL_INFO("CALLBACK");
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
SearchData::SetWrap(true);
} else {
SearchData::SetWrap(false);
}
}
void Search::OnCheckBoxEventCase(GtkWidget *widget, gpointer data)
{
//APPL_INFO("CALLBACK");
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
SearchData::SetCase(true);
} else {
SearchData::SetCase(false);
}
}
void Search::OnCheckBoxEventRegExp(GtkWidget *widget, gpointer data)
{
//APPL_INFO("CALLBACK");
Search * self = static_cast<Search*>(data);
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
SearchData::SetRegExp(true);
gtk_widget_set_sensitive(self->m_CkMatchCase, false);
} else {
SearchData::SetRegExp(false);
gtk_widget_set_sensitive(self->m_CkMatchCase, true);
}
}
void Search::OnEntrySearchChange(GtkWidget *widget, gpointer data)
{
//APPL_INFO("CALLBACK");
Search * self = static_cast<Search*>(data);
// update research data
const char *testData = gtk_entry_get_text(GTK_ENTRY(widget));
if (NULL != testData) {
etk::UString myDataString = testData;
SearchData::SetSearch(myDataString);
if (0 == strlen(testData)) {
self->m_haveSearchData = false;
Hide();
} else if ( eventId == ednMsgGuiSearch) {
if (true == IsHide()) {
Show();
} else {
self->m_haveSearchData = true;
}
gtk_widget_set_sensitive(self->m_BtPrevious, self->m_haveSearchData);
gtk_widget_set_sensitive(self->m_BtNext, self->m_haveSearchData);
if (false == self->m_haveSearchData) {
gtk_widget_set_sensitive(self->m_BtReplace, false);
gtk_widget_set_sensitive(self->m_BtReplaceAndNext, false);
} else {
gtk_widget_set_sensitive(self->m_BtReplace, true);
gtk_widget_set_sensitive(self->m_BtReplaceAndNext, true);
Hide();
}
}
}
void Search::OnEntryReplaceChange(GtkWidget *widget, gpointer data)
{
//APPL_INFO("CALLBACK");
Search * self = static_cast<Search*>(data);
// update replace data
const char *testData = gtk_entry_get_text(GTK_ENTRY(widget));
if (NULL != testData) {
etk::UString myDataString = testData;
SearchData::SetReplace(myDataString);
if (0 == strlen(testData)) {
self->m_haveReplaceData = false;
} else {
self->m_haveReplaceData = true;
}
if (false == self->m_haveSearchData) {
gtk_widget_set_sensitive(self->m_BtReplace, false);
gtk_widget_set_sensitive(self->m_BtReplaceAndNext, false);
} else {
gtk_widget_set_sensitive(self->m_BtReplace, true);
gtk_widget_set_sensitive(self->m_BtReplaceAndNext, true);
}
}
}
*/

View File

@ -133,6 +133,8 @@ void APP_Init(void)
ewol::shortCut::Add("ctrl+l", ednMsgGuiGotoLine, "???");
ewol::shortCut::Add("ctrl+f", ednMsgGuiSearch, "");
// add files
APPL_INFO("show list of files : ");