NetSurf
Data Structures | Macros | Enumerations | Functions | Variables
search.c File Reference

Free text search (implementation) More...

#include "amiga/os3support.h"
#include "utils/config.h"
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include <proto/intuition.h>
#include <proto/exec.h>
#include <proto/window.h>
#include <proto/layout.h>
#include <proto/string.h>
#include <proto/button.h>
#include <proto/label.h>
#include <proto/checkbox.h>
#include <classes/window.h>
#include <gadgets/layout.h>
#include <gadgets/string.h>
#include <gadgets/button.h>
#include <gadgets/checkbox.h>
#include <images/label.h>
#include <reaction/reaction_macros.h>
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/utils.h"
#include "content/content.h"
#include "netsurf/browser_window.h"
#include "desktop/search.h"
#include "netsurf/mouse.h"
#include "netsurf/window.h"
#include "netsurf/search.h"
#include "amiga/libs.h"
#include "amiga/gui.h"
#include "amiga/memory.h"
#include "amiga/search.h"
#include "amiga/object.h"
#include "amiga/theme.h"
#include "amiga/utf8.h"
Include dependency graph for search.c:

Go to the source code of this file.

Data Structures

struct  find_window
 

Macros

#define NOF_ELEMENTS(array)   (sizeof(array)/sizeof(*(array)))
 

Enumerations

enum  {
  OID_S_MAIN = 0 , GID_S_MAIN , GID_S_NEXT , GID_S_PREV ,
  GID_S_SEARCHSTRING , GID_S_SHOWALL , GID_S_CASE , GID_S_LAST
}
 
enum  {
  SSTR_TITLE = 0 , SSTR_CASE , SSTR_SHOWALL , SSTR_PREV ,
  SSTR_NEXT , SSTR_LAST
}
 

Functions

search_flags_t ami_search_flags (void)
 retrieve state of 'case sensitive', 'show all' checks in gui More...
 
char * ami_search_string (void)
 retrieve string being searched for from gui More...
 
static void ami_search_set_status (bool found, void *p)
 Change the displayed search status. More...
 
static void ami_search_set_hourglass (bool active, void *p)
 display hourglass while searching More...
 
static void ami_search_add_recent (const char *string, void *p)
 add search string to recent searches list front is at liberty how to implement the bare notification should normally store a strdup() of the string; core gives no guarantee of the integrity of the const char * More...
 
static void ami_search_set_forward_state (bool active, void *p)
 activate search forwards button in gui More...
 
static void ami_search_set_back_state (bool active, void *p)
 activate search forwards button in gui More...
 
static BOOL ami_search_event (void *w)
 
struct gui_windowami_search_get_gwin (struct find_window *fw)
 Obtain gui window associated with find window. More...
 
void ami_search_open (struct gui_window *gwin)
 Change the displayed search status. More...
 
void ami_search_close (void)
 Close search. More...
 

Variables

static bool search_insert
 
static struct find_windowfwin = NULL
 
static struct gui_search_table search_table
 
static const struct ami_win_event_table ami_search_table
 
struct gui_search_tableamiga_search_table = &search_table
 

Detailed Description

Free text search (implementation)

Definition in file search.c.

Macro Definition Documentation

◆ NOF_ELEMENTS

#define NOF_ELEMENTS (   array)    (sizeof(array)/sizeof(*(array)))

Definition at line 67 of file search.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
OID_S_MAIN 
GID_S_MAIN 
GID_S_NEXT 
GID_S_PREV 
GID_S_SEARCHSTRING 
GID_S_SHOWALL 
GID_S_CASE 
GID_S_LAST 

Definition at line 72 of file search.c.

◆ anonymous enum

anonymous enum
Enumerator
SSTR_TITLE 
SSTR_CASE 
SSTR_SHOWALL 
SSTR_PREV 
SSTR_NEXT 
SSTR_LAST 

Definition at line 84 of file search.c.

Function Documentation

◆ ami_search_add_recent()

void ami_search_add_recent ( const char *  string,
void *  p 
)
static

add search string to recent searches list front is at liberty how to implement the bare notification should normally store a strdup() of the string; core gives no guarantee of the integrity of the const char *

Parameters
stringsearch pattern
pthe pointer sent to search_verify_new() / search_create_context()

Definition at line 351 of file search.c.

◆ ami_search_close()

void ami_search_close ( void  )

Close search.

Definition at line 229 of file search.c.

References ami_gui_get_browser_window(), ami_gui_set_find_window(), ami_gui_win_list_remove(), ami_utf8_free(), browser_window_search_clear(), fwin, find_window::gwin, find_window::message, find_window::objects, OID_S_MAIN, and SSTR_LAST.

Referenced by ami_search_event(), and gui_window_destroy().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ami_search_event()

static BOOL ami_search_event ( void *  w)
static

Definition at line 244 of file search.c.

References ami_gui_get_browser_window(), ami_gui_get_window(), ami_search_close(), ami_search_flags(), ami_search_string(), browser_window_search(), browser_window_search_clear(), fwin, GID_S_NEXT, GID_S_PREV, GID_S_SEARCHSTRING, find_window::gwin, find_window::objects, OID_S_MAIN, RefreshSetGadgetAttrs(), result, SEARCH_FLAG_FORWARDS, search_insert, and find_window::win.

Here is the call graph for this function:

◆ ami_search_flags()

search_flags_t ami_search_flags ( void  )

retrieve state of 'case sensitive', 'show all' checks in gui

Definition at line 386 of file search.c.

References fwin, GID_S_CASE, GID_S_SHOWALL, find_window::objects, SEARCH_FLAG_CASE_SENSITIVE, and SEARCH_FLAG_SHOWALL.

Referenced by ami_search_event().

Here is the caller graph for this function:

◆ ami_search_get_gwin()

struct gui_window * ami_search_get_gwin ( struct find_window fw)

Obtain gui window associated with find window.

Definition at line 127 of file search.c.

References find_window::gwin.

Referenced by gui_window_destroy().

Here is the caller graph for this function:

◆ ami_search_open()

void ami_search_open ( struct gui_window gwin)

Change the displayed search status.

Parameters
gwingui window to open search for.

Definition at line 140 of file search.c.

References ami_gui_get_browser_window(), ami_gui_get_screen(), ami_gui_get_screen_title(), ami_gui_get_shared_msgport(), ami_gui_set_find_window(), ami_gui_win_list_add(), ami_search_table, ami_utf8_easy(), AMINS_FINDWINDOW, browser_window_search_clear(), ButtonObj, CheckBoxObj, fwin, GID_S_CASE, GID_S_MAIN, GID_S_NEXT, GID_S_PREV, GID_S_SEARCHSTRING, GID_S_SHOWALL, find_window::gwin, LayoutHObj, LayoutVObj, find_window::message, messages_get(), find_window::objects, OID_S_MAIN, search_insert, SSTR_CASE, SSTR_NEXT, SSTR_PREV, SSTR_SHOWALL, SSTR_TITLE, StringObj, find_window::win, and WindowObj.

Referenced by HOOKF().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ami_search_set_back_state()

void ami_search_set_back_state ( bool  active,
void *  p 
)
static

activate search forwards button in gui

Parameters
activeactivate/inactivate
pthe pointer sent to search_verify_new() / search_create_context()

Definition at line 375 of file search.c.

References fwin, GID_S_PREV, find_window::objects, RefreshSetGadgetAttrs(), and find_window::win.

Here is the call graph for this function:

◆ ami_search_set_forward_state()

void ami_search_set_forward_state ( bool  active,
void *  p 
)
static

activate search forwards button in gui

Parameters
activeactivate/inactivate
pthe pointer sent to search_verify_new() / search_create_context()

Definition at line 361 of file search.c.

References fwin, GID_S_NEXT, find_window::objects, RefreshSetGadgetAttrs(), and find_window::win.

Here is the call graph for this function:

◆ ami_search_set_hourglass()

void ami_search_set_hourglass ( bool  active,
void *  p 
)
static

display hourglass while searching

Parameters
activestart/stop indicator
pthe pointer sent to search_verify_new() / search_create_context()

Definition at line 322 of file search.c.

References ami_update_pointer(), fwin, GUI_POINTER_DEFAULT, GUI_POINTER_WAIT, and find_window::win.

Here is the call graph for this function:

◆ ami_search_set_status()

void ami_search_set_status ( bool  found,
void *  p 
)
static

Change the displayed search status.

Parameters
foundsearch pattern matched in text
pthe pointer sent to search_verify_new() / search_create_context()

Definition at line 312 of file search.c.

◆ ami_search_string()

char * ami_search_string ( void  )

retrieve string being searched for from gui

Definition at line 334 of file search.c.

References fwin, GID_S_SEARCHSTRING, find_window::objects, and text().

Referenced by ami_search_event().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ ami_search_table

const struct ami_win_event_table ami_search_table
static
Initial value:
= {
NULL,
}
static BOOL ami_search_event(void *w)
Definition: search.c:244

Definition at line 120 of file search.c.

Referenced by ami_search_open().

◆ amiga_search_table

struct gui_search_table* amiga_search_table = &search_table

Definition at line 125 of file search.c.

Referenced by main().

◆ fwin

struct find_window* fwin = NULL
static

◆ search_insert

bool search_insert
static

Definition at line 70 of file search.c.

Referenced by ami_search_event(), and ami_search_open().

◆ search_table

struct gui_search_table search_table
static
Initial value:
= {
}
static void ami_search_set_back_state(bool active, void *p)
activate search forwards button in gui
Definition: search.c:375
static void ami_search_set_hourglass(bool active, void *p)
display hourglass while searching
Definition: search.c:322
static void ami_search_add_recent(const char *string, void *p)
add search string to recent searches list front is at liberty how to implement the bare notification ...
Definition: search.c:351
static void ami_search_set_forward_state(bool active, void *p)
activate search forwards button in gui
Definition: search.c:361
static void ami_search_set_status(bool found, void *p)
Change the displayed search status.
Definition: search.c:312

Definition at line 112 of file search.c.