r9480 jmb - in /trunk/tools/heapview: ./ Makefile build/ src/ src/Makefile src/heap.cpp src/heap.h src/main.cpp src/ui.cpp src/ui.h
by netsurf@semichrome.net
Author: jmb
Date: Fri Aug 28 06:11:26 2009
New Revision: 9480
URL: http://source.netsurf-browser.org?rev=9480&view=rev
Log:
Viewer for log files generated by memdebug.
Added:
trunk/tools/heapview/ (with props)
trunk/tools/heapview/Makefile
trunk/tools/heapview/build/ (with props)
trunk/tools/heapview/src/
trunk/tools/heapview/src/Makefile
trunk/tools/heapview/src/heap.cpp
trunk/tools/heapview/src/heap.h
trunk/tools/heapview/src/main.cpp
trunk/tools/heapview/src/ui.cpp
trunk/tools/heapview/src/ui.h
Propchange: trunk/tools/heapview/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Aug 28 06:11:26 2009
@@ -1,0 +1,1 @@
+build-*
Added: trunk/tools/heapview/Makefile
URL: http://source.netsurf-browser.org/trunk/tools/heapview/Makefile?rev=9480&...
==============================================================================
--- trunk/tools/heapview/Makefile (added)
+++ trunk/tools/heapview/Makefile Fri Aug 28 06:11:26 2009
@@ -1,0 +1,28 @@
+# Component settings
+COMPONENT := heapview
+COMPONENT_VERSION := 0.0.1
+# We produce an application binary
+COMPONENT_TYPE := binary
+
+# Setup the tooling
+include build/makefiles/Makefile.tools
+
+# Toolchain flags
+WARNFLAGS := -Wall -Wextra -Wundef -Wpointer-arith -Wcast-align \
+ -Wwrite-strings -Werror -pedantic
+CXXFLAGS := -I$(CURDIR)/include/ -I$(CURDIR)/src $(WARNFLAGS) $(CXXFLAGS)
+
+# GTKMM
+ifneq ($(findstring clean,$(MAKECMDGOALS)),clean)
+ ifneq ($(PKGCONFIG),)
+ CXXFLAGS := $(CXXFLAGS) $(shell $(PKGCONFIG) gtkmm-2.4 --cflags)
+ LDFLAGS := $(LDFLAGS) $(shell $(PKGCONFIG) gtkmm-2.4 --libs)
+ else
+ $(error Non pkg-config gtkmm support is too much effort)
+ endif
+endif
+
+include build/makefiles/Makefile.top
+
+# Extra installation rules
+
Propchange: trunk/tools/heapview/build/
------------------------------------------------------------------------------
--- svn:externals (added)
+++ svn:externals Fri Aug 28 06:11:26 2009
@@ -1,0 +1,1 @@
+makefiles svn://svn.netsurf-browser.org/trunk/tools/buildsystem/makefiles
Added: trunk/tools/heapview/src/Makefile
URL: http://source.netsurf-browser.org/trunk/tools/heapview/src/Makefile?rev=9...
==============================================================================
--- trunk/tools/heapview/src/Makefile (added)
+++ trunk/tools/heapview/src/Makefile Fri Aug 28 06:11:26 2009
@@ -1,0 +1,3 @@
+DIR_SOURCES := heap.cpp main.cpp ui.cpp
+
+include build/makefiles/Makefile.subdir
Added: trunk/tools/heapview/src/heap.cpp
URL: http://source.netsurf-browser.org/trunk/tools/heapview/src/heap.cpp?rev=9...
==============================================================================
--- trunk/tools/heapview/src/heap.cpp (added)
+++ trunk/tools/heapview/src/heap.cpp Fri Aug 28 06:11:26 2009
@@ -1,0 +1,351 @@
+#include <fstream>
+#include <iostream>
+#include <sstream>
+
+#include "heap.h"
+
+class Heap::FileParser
+{
+public:
+ FileParser(Heap &heap, const char *filename)
+ : input(filename), heap(heap)
+ {
+ }
+
+ ~FileParser()
+ {
+ if (input.is_open())
+ input.close();
+ }
+
+ void parse_step();
+
+private:
+ std::ifstream input;
+ Heap &heap;
+
+ FileParser(const FileParser &rhs);
+ FileParser &operator=(const FileParser &rhs);
+
+ void parseMem(const std::string &line);
+ void parseMalloc(const std::string &line, std::string::size_type delim);
+ void parseCalloc(const std::string &line, std::string::size_type delim);
+ void parseRealloc(const std::string &line,
+ std::string::size_type delim);
+ void parseFree(const std::string &line, std::string::size_type delim);
+ void parseStrdup(const std::string &line, std::string::size_type delim);
+ void parseStrndup(const std::string &line,
+ std::string::size_type delim);
+};
+
+Heap::~Heap()
+{
+ ChunkSet::iterator first = chunks.begin();
+ ChunkSet::iterator last = chunks.end();
+
+ for (; first != last; first++) {
+ delete (*first);
+ }
+
+ chunks.clear();
+
+ clients.clear();
+
+ if (parser != 0)
+ delete parser;
+}
+
+Heap::Client::~Client()
+{
+}
+
+void Heap::simulate(const char *filename)
+{
+ if (parser == 0)
+ parser = new FileParser(*this, filename);
+
+ try {
+ parser->parse_step();
+ } catch(...) {
+ delete parser;
+ parser = 0;
+ }
+}
+
+void Heap::registerClient(Client &client)
+{
+ clients.push_back(&client);
+}
+
+void Heap::deregisterClient(Client &client)
+{
+ ClientVector::iterator it = clients.begin();
+ ClientVector::iterator end = clients.end();
+
+ for (; it != end; it++) {
+ if ((*it) == &client) {
+ clients.erase(it);
+ break;
+ }
+ }
+}
+
+void Heap::processEvent(const Op &op)
+{
+ if (op.type == Op::OP_ALLOC) {
+ Chunk *c = new Chunk(op.address, op.length);
+
+ chunks.insert(c);
+
+ dispatchModified(Client::CREATED, *c);
+ } else {
+ Chunk c(op.address, op.length);
+
+ ChunkSet::iterator it = chunks.find(&c);
+
+ if (it != chunks.end()) {
+ dispatchModified(Client::DESTROYED, *(*it));
+
+ delete (*it);
+ chunks.erase(it);
+ } else {
+ std::cerr << "Free of unallocated block @ ";
+ std::cerr << op.address << std::endl;
+ }
+ }
+}
+
+void Heap::dispatchModified(Client::Type type, const Chunk &chunk)
+{
+ /* Ignore large (mmapped) chunks */
+ if (chunk.length >= 128 * 1024)
+ return;
+
+ ClientVector::iterator first = clients.begin();
+ ClientVector::iterator last = clients.end();
+
+ for (; first != last; first++) {
+ (*first)->chunkModified(type, chunk);
+ }
+}
+
+/******************************************************************************
+ * File Parser *
+ ******************************************************************************/
+
+void Heap::FileParser::parse_step()
+{
+ if (input.is_open()) {
+ std::string line;
+
+ while (input.eof() == false) {
+ std::getline(input, line);
+
+ /* Ensure we have a MEM line */
+ if (line.find("MEM", 0, 3) != line.npos) {
+ parseMem(line);
+ break;
+ }
+ }
+
+ if (input.eof())
+ throw 0;
+ } else
+ throw 0;
+}
+
+void Heap::FileParser::parseMem(const std::string &line)
+{
+ /* Skip over MEM */
+ std::string::size_type delim = line.find_first_of(" ", 0);
+ std::string::size_type start = line.find_first_not_of(" ", delim);
+
+ /* Skip over <filename>:<line> */
+ delim = line.find_first_of(" ", start);
+ start = line.find_first_not_of(" ", delim);
+
+ /* Now, work out the function we're dealing with */
+ delim = line.find_first_of("(", start);
+ if (line.compare(start, delim - start, "malloc") == 0) {
+ parseMalloc(line, delim);
+ } else if (line.compare(start, delim - start, "calloc") == 0) {
+ parseCalloc(line, delim);
+ } else if (line.compare(start, delim - start, "realloc") == 0) {
+ parseRealloc(line, delim);
+ } else if (line.compare(start, delim - start, "free") == 0) {
+ parseFree(line, delim);
+ } else if (line.compare(start, delim - start, "strdup") == 0) {
+ parseStrdup(line, delim);
+ } else if (line.compare(start, delim - start, "strndup") == 0) {
+ parseStrndup(line, delim);
+ } else {
+ std::cerr << "Unexpected function ";
+ std::cerr << line.substr(start, delim - start) << std::endl;
+ }
+}
+
+void Heap::FileParser::parseMalloc(const std::string &line,
+ std::string::size_type delim)
+{
+ Op op;
+
+ op.type = Op::OP_ALLOC;
+
+ /* (<size>) = <addr> */
+ std::string::size_type start = line.find_first_not_of("(", delim);
+ delim = line.find_first_of(")", start);
+
+ std::istringstream size(line.substr(start, delim - start));
+ size >> std::dec >> op.length;
+
+ /* Now, the address */
+ start = line.find_first_not_of(" )=", delim);
+ std::istringstream address(line.substr(start, line.npos - start));
+ address >> std::hex >> op.address;
+
+ /* Send event */
+ heap.processEvent(op);
+}
+
+void Heap::FileParser::parseCalloc(const std::string &line,
+ std::string::size_type delim)
+{
+ Op op;
+
+ op.type = Op::OP_ALLOC;
+
+ /* (<nmemb>, <size>) = <addr> */
+ std::string::size_type start = line.find_first_not_of("(", delim);
+ delim = line.find_first_of(",", start);
+
+ uint64_t nmemb, size;
+
+ std::istringstream ns(line.substr(start, delim - start));
+ ns >> std::dec >> nmemb;
+
+ /* Size */
+ start = line.find_first_not_of(", ", delim);
+ delim = line.find_first_of(")", start);
+ std::istringstream ss(line.substr(start, delim - start));
+ ss >> std::dec >> size;
+
+ op.length = nmemb * size;
+
+ /* Address */
+ start = line.find_first_not_of(" )=", delim);
+ std::istringstream as(line.substr(start, line.npos - start));
+ as >> std::hex >> op.address;
+
+ /* Send event */
+ heap.processEvent(op);
+}
+
+void Heap::FileParser::parseRealloc(const std::string &line,
+ std::string::size_type delim)
+{
+ Op op;
+
+ op.type = Op::OP_FREE;
+
+ /* (<oldaddr>, <size>) = <addr> */
+ std::string::size_type start = line.find_first_not_of("(", delim);
+ delim = line.find_first_of(",", start);
+
+ std::istringstream ns(line.substr(start, delim - start));
+ ns >> std::hex >> op.address;
+
+ /* realloc(NULL, ...) == malloc(...) */
+ if (op.address != 0) {
+ op.length = 0;
+
+ /* Release old chunk */
+ heap.processEvent(op);
+ }
+
+ op.type = Op::OP_ALLOC;
+
+ /* Size */
+ start = line.find_first_not_of(", ", delim);
+ delim = line.find_first_of(")", start);
+ std::istringstream ss(line.substr(start, delim - start));
+ ss >> std::dec >> op.length;
+
+ /* Address */
+ start = line.find_first_not_of(" )=", delim);
+ std::istringstream as(line.substr(start, line.npos - start));
+ as >> std::hex >> op.address;
+
+ /* realloc(..., 0) == free(...) */
+ if (op.length != 0) {
+ /* Send event */
+ heap.processEvent(op);
+ }
+}
+
+void Heap::FileParser::parseFree(const std::string &line,
+ std::string::size_type delim)
+{
+ Op op;
+
+ op.type = Op::OP_FREE;
+ op.length = 0;
+
+ /* (<addr>) */
+ std::string::size_type start = line.find_first_not_of("(", delim);
+ delim = line.find_first_of(")", start);
+
+ std::istringstream ss(line.substr(start, delim - start));
+ ss >> std::hex >> op.address;
+
+ /* Send event */
+ heap.processEvent(op);
+}
+
+void Heap::FileParser::parseStrdup(const std::string &line,
+ std::string::size_type delim)
+{
+ Op op;
+
+ op.type = Op::OP_ALLOC;
+
+ /* (<oldaddr>) (<size>) = <addr> */
+ delim = line.find_first_of("(", delim + 1);
+
+ std::string::size_type start = line.find_first_not_of("(", delim);
+ delim = line.find_first_of(")", start);
+
+ std::istringstream ss(line.substr(start, delim - start));
+ ss >> std::dec >> op.length;
+
+ start = line.find_first_not_of(" )=", delim);
+ std::istringstream as(line.substr(start, line.npos - start));
+ as >> std::hex >> op.address;
+
+ /* Send event */
+ heap.processEvent(op);
+}
+
+void Heap::FileParser::parseStrndup(const std::string &line,
+ std::string::size_type delim)
+{
+ Op op;
+
+ op.type = Op::OP_ALLOC;
+
+ /* (<oldaddr>, <n>) (<size>) = <addr> */
+ delim = line.find_first_of("(", delim + 1);
+
+ std::string::size_type start = line.find_first_not_of("(", delim);
+ delim = line.find_first_of(")", start);
+
+ std::istringstream ss(line.substr(start, delim - start));
+ ss >> std::dec >> op.length;
+
+ start = line.find_first_not_of(" )=", delim);
+ std::istringstream as(line.substr(start, line.npos - start));
+ as >> std::hex >> op.address;
+
+ /* Send event */
+ heap.processEvent(op);
+}
+
Added: trunk/tools/heapview/src/heap.h
URL: http://source.netsurf-browser.org/trunk/tools/heapview/src/heap.h?rev=948...
==============================================================================
--- trunk/tools/heapview/src/heap.h (added)
+++ trunk/tools/heapview/src/heap.h Fri Aug 28 06:11:26 2009
@@ -1,0 +1,74 @@
+#include <set>
+#include <vector>
+
+class Heap
+{
+public:
+ Heap() : parser(0) {}
+ ~Heap();
+
+ void simulate(const char *filename);
+
+ struct Chunk
+ {
+ Chunk(uint64_t address, size_t length)
+ {
+ this->address = address;
+ this->length = length;
+ }
+
+ uint64_t address;
+ size_t length;
+ };
+
+ class Client
+ {
+ public:
+ Client() {}
+ virtual ~Client() = 0;
+
+ enum Type { CREATED, DESTROYED };
+
+ virtual void chunkModified(Type type, const Chunk &chunk) = 0;
+ };
+
+ void registerClient(Client &client);
+ void deregisterClient(Client &client);
+
+private:
+ class FileParser;
+
+ FileParser *parser;
+
+ struct cmp {
+ bool operator()(const Chunk *a, const Chunk *b)
+ {
+ return a->address < b->address;
+ }
+ };
+
+ typedef std::set<Chunk *, cmp> ChunkSet;
+
+ ChunkSet chunks;
+
+ typedef std::vector<Client *> ClientVector;
+
+ ClientVector clients;
+
+ Heap(const Heap &rhs);
+ Heap &operator=(const Heap &rhs);
+
+ struct Op
+ {
+ enum {
+ OP_ALLOC,
+ OP_FREE
+ } type;
+
+ uint64_t address;
+ size_t length;
+ };
+
+ void processEvent(const Op &op);
+ void dispatchModified(Client::Type type, const Chunk &chunk);
+};
Added: trunk/tools/heapview/src/main.cpp
URL: http://source.netsurf-browser.org/trunk/tools/heapview/src/main.cpp?rev=9...
==============================================================================
--- trunk/tools/heapview/src/main.cpp (added)
+++ trunk/tools/heapview/src/main.cpp Fri Aug 28 06:11:26 2009
@@ -1,0 +1,28 @@
+#include <iostream>
+
+#include "heap.h"
+#include "ui.h"
+
+int main(int argc, char **argv)
+{
+ if (argc != 2) {
+ std::cerr << "Usage: heapview <filename>" << std::endl;
+ return 1;
+ }
+
+ Heap heap;
+ UI ui(argc, argv);
+ bool quit = false;
+
+ heap.registerClient(ui);
+
+ while (quit == false) {
+ heap.simulate(argv[1]);
+ quit = ui.poll();
+ }
+
+ heap.deregisterClient(ui);
+
+ return 0;
+}
+
Added: trunk/tools/heapview/src/ui.cpp
URL: http://source.netsurf-browser.org/trunk/tools/heapview/src/ui.cpp?rev=948...
==============================================================================
--- trunk/tools/heapview/src/ui.cpp (added)
+++ trunk/tools/heapview/src/ui.cpp Fri Aug 28 06:11:26 2009
@@ -1,0 +1,295 @@
+#include <iostream>
+
+#include <gtkmm/drawingarea.h>
+#include <gtkmm/scrolledwindow.h>
+
+#include "heap.h"
+
+#include "ui.h"
+
+class UI::Window : public Gtk::Window
+{
+public:
+ Window(UI &ui)
+ : area(ui)
+ {
+ /** \todo Less hacky window size */
+ set_default_size(Row::NBYTES + 20, 600);
+
+ scrollpane.set_policy(Gtk::POLICY_AUTOMATIC,
+ Gtk::POLICY_ALWAYS);
+ scrollpane.add(area);
+
+ add(scrollpane);
+
+ show_all_children();
+ }
+
+ ~Window() {}
+
+ void set_dimensions(int width, int height)
+ {
+ int oldwidth, oldheight;
+
+ area.get_size_request(oldwidth, oldheight);
+
+ if (width != oldwidth || height != oldheight)
+ area.set_size_request(width, height);
+ }
+
+ void redraw_row(int row, int left, int right)
+ {
+ area.queue_draw_area(left, row, right - left, 1);
+ }
+private:
+ class DrawingArea : public Gtk::DrawingArea
+ {
+ public:
+ DrawingArea(UI &ui)
+ {
+ this->ui = &ui;
+ }
+
+ virtual ~DrawingArea() {}
+
+ protected:
+ virtual bool on_expose_event(GdkEventExpose *event)
+ {
+ Glib::RefPtr<Gdk::Window> window = get_window();
+
+ if (window) {
+ Cairo::RefPtr<Cairo::Context> cr =
+ window->create_cairo_context();
+
+ if (event) {
+ /* Clip to redraw region */
+ cr->rectangle(event->area.x,
+ event->area.y,
+ event->area.width,
+ event->area.height);
+ cr->clip();
+ }
+
+ /* Antialiasing is pointless */
+ cr->set_antialias(Cairo::ANTIALIAS_NONE);
+
+ cr->set_line_width(1.0);
+ cr->set_source_rgb(0.0, 0.0, 0.8);
+
+ /* Now, force the UI to redraw */
+ ui->redraw(cr);
+ }
+
+ return true;
+ }
+
+ private:
+ UI *ui;
+ };
+
+ DrawingArea area;
+
+ Gtk::ScrolledWindow scrollpane;
+};
+
+UI::UI(int argc, char **argv)
+ : Heap::Client(), pollCount(0), gtkenv(argc, argv)
+{
+ window = new Window(*this);
+
+ window->show();
+}
+
+UI::~UI()
+{
+ RowSet::iterator first = rows.begin();
+ RowSet::iterator last = rows.end();
+
+ for (; first != last; first++) {
+ delete (*first);
+ }
+
+ rows.clear();
+
+ delete window;
+}
+
+bool UI::poll()
+{
+ while (Gtk::Main::events_pending()) {
+ Gtk::Main::iteration();
+ }
+
+ /* Periodically update the drawing area dimensions */
+ /** \todo Can this be done better? */
+ if (++pollCount > 1000) {
+ usleep(100);
+
+ window->set_dimensions(Row::NBYTES, rows.size());
+
+ pollCount = 0;
+ }
+
+ /* Somewhat nasty hack to detect window being closed */
+ return window->is_visible() == false;
+}
+
+void UI::redraw(Cairo::RefPtr<Cairo::Context> cr)
+{
+ RowSet::iterator it = rows.begin();
+ RowSet::iterator end = rows.end();
+ int32_t linecount = 0;
+ double t, r, b, l;
+
+ cr->get_clip_extents(l, t, r, b);
+
+ /* Redraw appropriate rows, culling those outside the clip region */
+ for (; it != end; it++) {
+ if (linecount >= t && linecount < b) {
+ cr->move_to(0, linecount);
+ (*it)->redraw(cr);
+ }
+
+ linecount++;
+ }
+}
+
+void UI::chunkModified(Heap::Client::Type type, const Heap::Chunk &chunk)
+{
+ /* Calculate base address of row */
+ uint64_t base = chunk.address & Row::MASK;
+ int row_num = -1;
+
+ /* Update each row affected by chunk */
+ do {
+ Row *row;
+ Row r(base);
+ RowSet::iterator it = rows.find(&r);
+
+ if (it == rows.end()) {
+ /* No row, so create it */
+ row = new Row(base);
+
+ std::pair<RowSet::iterator, bool> ret =
+ rows.insert(row);
+
+ it = ret.first;
+ } else {
+ row = *it;
+ }
+
+ /* Update row */
+ size_t first, last;
+ bytesForChunk(chunk, row->getBase(), first, last);
+
+ if (type == Heap::Client::CREATED)
+ row->setBits(first, last);
+ else
+ row->clearBits(first, last);
+
+ if (row_num == -1) {
+ /* Calculate index of first affected row */
+ /** \todo Find a better way of doing this */
+ RowSet::iterator find = rows.begin();
+
+ for (row_num = 0; find != it; find++)
+ row_num++;
+ } else {
+ row_num++;
+ }
+
+ /* Request redraw of affected section of row */
+ window->redraw_row(row_num, first, last);
+
+ base += Row::NBYTES;
+ } while (base < chunk.address + chunk.length);
+}
+
+void UI::bytesForChunk(const Heap::Chunk &chunk, uint64_t rowbase,
+ size_t &first, size_t &last)
+{
+ uint64_t f = chunk.address;
+ uint64_t l = chunk.address + chunk.length;
+
+ /* Find first byte in row affected by chunk */
+ if (f < rowbase)
+ f = rowbase;
+
+ /* Find last byte in row affected by chunk */
+ if (l > rowbase + Row::NBYTES)
+ l = rowbase + Row::NBYTES;
+
+ first = f - rowbase;
+ last = l - rowbase;
+}
+
+/******************************************************************************
+ * Row *
+ ******************************************************************************/
+
+void UI::Row::setBits(size_t first, size_t last)
+{
+ /* Mark affected bytes as allocated */
+ for (; first < last; first++) {
+ bytes.set(first);
+ }
+}
+
+void UI::Row::clearBits(size_t first, size_t last)
+{
+ /* Mark affected bytes as free */
+ for (; first < last; first++) {
+ bytes.set(first, 0);
+ }
+}
+
+void UI::Row::redraw(Cairo::RefPtr<Cairo::Context> cr)
+{
+ /* Don't bother redrawing blank rows */
+ if (bytes.none())
+ return;
+
+ /* Find the extents of the current clip region */
+ double t, r, b, l;
+ cr->get_clip_extents(l, t, r, b);
+
+ /* Cull pixels outside clip region */
+ const size_t min = l;
+ const size_t max = std::min(static_cast<double>(bytes.size()), r);
+ int first = -1, last = -1;
+
+
+ if (bytes.count() == bytes.size()) {
+ /* All bits set, so avoid testing them all */
+ cr->rel_move_to(min, 0);
+ cr->rel_line_to(max, 0);
+ } else {
+ /* Find spans of allocated bytes */
+ for (size_t i = min; i != max; i++) {
+ if (bytes.test(i)) {
+ if (first == -1) {
+ cr->rel_move_to(i - last, 0);
+
+ first = i;
+ last = i;
+ } else
+ last = i;
+ } else if (first != -1) {
+ cr->rel_line_to(last - first, 0);
+
+ first = -1;
+ }
+ }
+
+ /* Last span */
+ if (first != -1) {
+ cr->rel_line_to(last - first, 0);
+
+ first = -1;
+ }
+ }
+
+ /* Draw the path we've created */
+ cr->stroke();
+}
+
Added: trunk/tools/heapview/src/ui.h
URL: http://source.netsurf-browser.org/trunk/tools/heapview/src/ui.h?rev=9480&...
==============================================================================
--- trunk/tools/heapview/src/ui.h (added)
+++ trunk/tools/heapview/src/ui.h Fri Aug 28 06:11:26 2009
@@ -1,0 +1,69 @@
+#include <bitset>
+#include <set>
+
+#include <gtkmm/main.h>
+#include <gtkmm/window.h>
+
+class Heap::Client;
+class Heap::Chunk;
+
+class UI : public Heap::Client
+{
+public:
+ UI(int argc, char **argv);
+ ~UI();
+
+ bool poll();
+
+ void redraw(Cairo::RefPtr<Cairo::Context> cr);
+
+private:
+ class Window;
+
+ class Row
+ {
+ public:
+ static const size_t NBYTES = 1024;
+ static const size_t MASK = ~(NBYTES - 1);
+
+ explicit Row(uint64_t address) : base(address) {}
+ ~Row() {}
+
+ uint64_t getBase() { return base; }
+
+ void setBits(size_t first, size_t last);
+ void clearBits(size_t first, size_t last);
+
+ void redraw(Cairo::RefPtr<Cairo::Context> cr);
+
+ struct cmp
+ {
+ bool operator()(const Row *a, const Row *b)
+ {
+ return a->base < b->base;
+ }
+ };
+ private:
+ uint64_t base;
+ std::bitset<NBYTES> bytes;
+
+ Row(const Row &rhs);
+ Row &operator=(const Row &rhs);
+ };
+
+ typedef std::set<Row *, Row::cmp> RowSet;
+
+ RowSet rows;
+
+ int pollCount;
+
+ Gtk::Main gtkenv;
+ Window *window;
+
+ UI(const UI &rhs);
+ UI &operator=(const UI &rhs);
+
+ void chunkModified(Heap::Client::Type type, const Heap::Chunk &chunk);
+ static void bytesForChunk(const Heap::Chunk &chunk, uint64_t rowbase,
+ size_t &first, size_t &last);
+};
13 years, 7 months
r9479 MarkieB - /branches/MarkieB/windows/windows/gui.c
by netsurf@semichrome.net
Author: MarkieB
Date: Fri Aug 28 05:51:29 2009
New Revision: 9479
URL: http://source.netsurf-browser.org?rev=9479&view=rev
Log:
windows automatically handles scrolling after all :o)
Modified:
branches/MarkieB/windows/windows/gui.c
Modified: branches/MarkieB/windows/windows/gui.c
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/gui.c?...
==============================================================================
--- branches/MarkieB/windows/windows/gui.c (original)
+++ branches/MarkieB/windows/windows/gui.c Fri Aug 28 05:51:29 2009
@@ -1798,9 +1798,15 @@
POINT p;
GetCaretPos(&p);
HideCaret(w->main);
-
- /* sample screen elements that are being moved */
- gui_window_redraw_window(w);
+ SetCaretPos(p.x - w->requestscrollx, p.y - w->requestscrolly);
+ ShowCaret(w->main);
+ RECT r, redraw;
+ r.top = w->voffset;
+ r.bottom = w->voffset + w->height;
+ r.left = 0;
+ r.right = w->width;
+ ScrollWindowEx(w->main, - w->requestscrollx, - w->requestscrolly, &r,
+ NULL, NULL, &redraw, SW_INVALIDATE);
}
void gui_window_scroll_visible(struct gui_window *w, int x0, int y0,
13 years, 7 months
r9478 MarkieB - in /branches/MarkieB/windows: installer/NetSurfInstaller.nsi windows/gui.c windows/localhistory.c windows/res/back.bmp windows/res/forward.bmp windows/res/home.bmp windows/res/reload.bmp windows/res/stop.bmp windows/res/throbberinfo
by netsurf@semichrome.net
Author: MarkieB
Date: Fri Aug 28 04:45:42 2009
New Revision: 9478
URL: http://source.netsurf-browser.org?rev=9478&view=rev
Log:
redraw main window when moving local history window
Modified:
branches/MarkieB/windows/installer/NetSurfInstaller.nsi
branches/MarkieB/windows/windows/gui.c
branches/MarkieB/windows/windows/localhistory.c
branches/MarkieB/windows/windows/res/back.bmp
branches/MarkieB/windows/windows/res/forward.bmp
branches/MarkieB/windows/windows/res/home.bmp
branches/MarkieB/windows/windows/res/reload.bmp
branches/MarkieB/windows/windows/res/stop.bmp
branches/MarkieB/windows/windows/res/throbberinfo
Modified: branches/MarkieB/windows/installer/NetSurfInstaller.nsi
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/installer/NetS...
==============================================================================
--- branches/MarkieB/windows/installer/NetSurfInstaller.nsi (original)
+++ branches/MarkieB/windows/installer/NetSurfInstaller.nsi Fri Aug 28 04:45:42 2009
@@ -40,10 +40,7 @@
File ../windows/res/preferences
File ../windows/res/*.bmp
File ../windows/res/*.ico
- IfFileExists "$INSTDIR\res\throbber\*.*" +2
- CreateDirectory "$INSTDIR\res\throbber"
- SetOutPath "$INSTDIR\res\throbber"
- File ../windows/res/throbber/throbber*.png
+ File ../windows/res/throbber.avi
IfFileExists $SMPROGRAMS\NetSurf\NetSurf.lnk +2
CreateDirectory "$SMPROGRAMS\NetSurf"
SetOutPath "$INSTDIR"
Modified: branches/MarkieB/windows/windows/gui.c
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/gui.c?...
==============================================================================
--- branches/MarkieB/windows/windows/gui.c (original)
+++ branches/MarkieB/windows/windows/gui.c Fri Aug 28 04:45:42 2009
@@ -497,6 +497,7 @@
LPARAM lparam)
{
bool match = false;
+ bool historyactive = false;
struct gui_window *w = window_list;
while (w) {
if (w->main == hwnd) {
@@ -515,11 +516,14 @@
w = w->next;
}
}
- if ((match) && (current_gui == NULL) && (msg != WM_LBUTTONDOWN)) {
- if ((msg == WM_PAINT) || (msg == WM_NCHITTEST) ||
- (msg == WM_SETCURSOR))
+ if ((match) && (current_gui == NULL)) {
+ /* local history window is active */
+ if ((msg == WM_LBUTTONDOWN) || (msg == WM_PAINT))
+ historyactive = true;
+ else if ((msg == WM_NCHITTEST) || (msg == WM_SETCURSOR))
return DefWindowProc(hwnd, msg, wparam, lparam);
- return 0;
+ else
+ return 0;
}
current_gui = w;
switch(msg) {
@@ -1054,7 +1058,10 @@
w->redraw.bottom = MIN(ps.rcPaint.bottom, w->height);
redraw();
EndPaint(hwnd, &ps);
- return DefWindowProc(hwnd, msg, wparam, lparam);
+ DWORD ret = DefWindowProc(hwnd, msg, wparam, lparam);
+ if (historyactive)
+ current_gui = NULL;
+ return ret;
break;
}
case WM_NCPAINT:
@@ -1463,7 +1470,7 @@
{
HWND hwnd = CreateWindow("EDIT", "", WS_CHILD | WS_VISIBLE |
ES_AUTOHSCROLL | ES_OEMCONVERT,
- w->toolbuttondimension * w->ntoolbuttons + 4, 6,
+ w->toolbuttondimension * w->ntoolbuttons + 4, 10,
w->urlbarwidth - 8, w->toolbuttondimension - 12,
w->main, (HMENU) NSWS_ID_URLBAR, hinstance, NULL);
HFONT font = CreateFont(14, /* height */
@@ -1494,7 +1501,7 @@
{
HWND hwnd = Animate_Create(w->main, NSWS_ID_THROBBER,
WS_CHILD | WS_VISIBLE, hinstance);
- SetWindowPos(hwnd, HWND_TOPMOST, w->width - NSWS_THROBBER_WIDTH, 4,
+ SetWindowPos(hwnd, HWND_TOPMOST, w->width - NSWS_THROBBER_WIDTH - 4, 8,
NSWS_THROBBER_WIDTH, NSWS_THROBBER_WIDTH,
SWP_SHOWWINDOW);
Modified: branches/MarkieB/windows/windows/localhistory.c
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/localh...
==============================================================================
--- branches/MarkieB/windows/windows/localhistory.c (original)
+++ branches/MarkieB/windows/windows/localhistory.c Fri Aug 28 04:45:42 2009
@@ -51,6 +51,9 @@
INITCOMMONCONTROLSEX icc;
HICON hIcon = nsws_window_get_ico(true);
HICON hIconS = nsws_window_get_ico(false);
+ current_gui = NULL;
+ current_hwnd = NULL;
+ doublebuffering = false;
icc.dwSize = sizeof(icc);
icc.dwICC = ICC_BAR_CLASSES | ICC_WIN95_CLASSES;
@@ -75,11 +78,12 @@
LoadIcon(NULL, IDI_APPLICATION) : hIconS;
RegisterClassEx(&we);
LOG(("creating local history window for hInstance %p", hinstance));
- hwnd = CreateWindow(localhistorywindowclassname, "NetSurf History",
+ current_hwnd = CreateWindow(localhistorywindowclassname, "NetSurf History",
WS_THICKFRAME | WS_HSCROLL | WS_VSCROLL |
WS_CLIPCHILDREN | WS_CLIPSIBLINGS | CS_DBLCLKS,
CW_USEDEFAULT, CW_USEDEFAULT, 300,
400, NULL, NULL, hinstance, NULL);
+ hwnd = current_hwnd;
ShowWindow(hwnd, SW_SHOWNORMAL);
UpdateWindow(hwnd);
gui_window_set_localhistory(w, hwnd);
@@ -112,6 +116,26 @@
if (w != NULL)
nsws_localhistory_scroll_check(w);
break;
+ case WM_MOVE: {
+ RECT r, rmain;
+ int voffset;
+ if (w != NULL) {
+ current_gui = w;
+ current_hwnd = gui_window_main_window(w);
+ voffset = gui_window_voffset(w);
+ GetWindowRect(hwnd, &r);
+ GetWindowRect(current_hwnd, &rmain);
+ gui_window_redraw(w, MIN(r.top - rmain.top - voffset, 0),
+ MIN(r.left - rmain.left, 0),
+ gui_window_height(w) -
+ MIN(rmain.bottom - r.bottom, 0),
+ gui_window_width(w) -
+ MIN(rmain.right - r.right, 0));
+ current_gui = NULL;
+ current_hwnd = hwnd;
+ return DefWindowProc(hwnd, msg, wparam, lparam);
+ }
+ }
case WM_LBUTTONUP: {
int x,y;
x = GET_X_LPARAM(lparam);
@@ -119,19 +143,9 @@
if (bw != NULL) {
current_hwnd = gui_window_main_window(w);
current_gui = w;
- SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0,
- SWP_NOSIZE | SWP_NOMOVE);
- SetWindowPos(current_hwnd, HWND_TOPMOST, 0, 0, 0, 0,
- SWP_NOSIZE | SWP_NOMOVE);
if (history_click(bw, bw->history, x, y, false))
DestroyWindow(hwnd);
else {
- SetWindowPos(hwnd, HWND_TOPMOST,
- 0, 0, 0, 0,
- SWP_NOSIZE | SWP_NOMOVE);
- SetWindowPos(current_hwnd, HWND_NOTOPMOST,
- 0, 0, 0, 0,
- SWP_NOSIZE | SWP_NOMOVE);
current_hwnd = hwnd;
current_gui = NULL;
}
@@ -156,15 +170,9 @@
break;
}
case WM_CLOSE:
- if (w != NULL)
- SetWindowPos(gui_window_main_window(w), HWND_TOPMOST,
- 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
DestroyWindow(hwnd);
break;
case WM_DESTROY:
- if (w != NULL)
- SetWindowPos(gui_window_main_window(w), HWND_TOPMOST,
- 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
PostQuitMessage(0);
break;
default:
@@ -196,8 +204,6 @@
SetWindowPos(hwnd, HWND_TOPMOST, r.left + margin/2, r.top + margin/2,
width, height, SWP_SHOWWINDOW);
- current_hwnd = hwnd;
- current_gui = NULL;
history_redraw(bw->history);
}
Modified: branches/MarkieB/windows/windows/res/back.bmp
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/res/ba...
==============================================================================
Binary files - no diff available.
Modified: branches/MarkieB/windows/windows/res/forward.bmp
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/res/fo...
==============================================================================
Binary files - no diff available.
Modified: branches/MarkieB/windows/windows/res/home.bmp
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/res/ho...
==============================================================================
Binary files - no diff available.
Modified: branches/MarkieB/windows/windows/res/reload.bmp
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/res/re...
==============================================================================
Binary files - no diff available.
Modified: branches/MarkieB/windows/windows/res/stop.bmp
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/res/st...
==============================================================================
Binary files - no diff available.
Modified: branches/MarkieB/windows/windows/res/throbberinfo
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/res/th...
==============================================================================
--- branches/MarkieB/windows/windows/res/throbberinfo (original)
+++ branches/MarkieB/windows/windows/res/throbberinfo Fri Aug 28 04:45:42 2009
@@ -1,4 +1,6 @@
the 'gnome foot' throbber was retrieved from the K-Meleon website
+
+http://kmeleon.sourceforge.net/wiki/SkinsAndThrobbers
Gnome's foot Throbber (73 Kb) - by Mauricio Wolff
13 years, 7 months
r9475 MarkieB - /branches/MarkieB/windows/windows/gui.c
by netsurf@semichrome.net
Author: MarkieB
Date: Fri Aug 28 01:24:16 2009
New Revision: 9475
URL: http://source.netsurf-browser.org?rev=9475&view=rev
Log:
throbber now working properly - albeit the avi is borrowed :o)
Modified:
branches/MarkieB/windows/windows/gui.c
Modified: branches/MarkieB/windows/windows/gui.c
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/gui.c?...
==============================================================================
--- branches/MarkieB/windows/windows/gui.c (original)
+++ branches/MarkieB/windows/windows/gui.c Fri Aug 28 01:24:16 2009
@@ -72,7 +72,7 @@
static int open_windows = 0;
#define NTOOLBUTTONS 5
-#define NSWS_THROBBER_WIDTH 32
+#define NSWS_THROBBER_WIDTH 24
#define NSWS_URL_ENTER (WM_USER)
struct gui_window {
@@ -96,8 +96,9 @@
int urlbarwidth; /**< width of url bar */
int ntoolbuttons; /**< number of toolbar buttons */
int toolbuttondimension; /**< width, height of buttons */
- int voffset; /** height of toolbar */
- TBBUTTON buttons[NTOOLBUTTONS + 1]; /* 1 = url bar */
+ int voffset; /**< height of toolbar */
+ bool throbbing; /**< whether currently throbbing */
+ TBBUTTON buttons[NTOOLBUTTONS + 1]; /* url bar, throbber */
HBITMAP hbmp[NTOOLBUTTONS]; /**< tool button images */
HACCEL acceltable; /**< accelerators */
@@ -1101,6 +1102,7 @@
/* re-create toolbar to adjust width of url bar holder */
DestroyWindow(w->toolbar);
+ DestroyWindow(w->throbber);
/* memorize url */
int len = SendMessage(w->urlbar, WM_GETTEXTLENGTH, 0, 0);
char temp[len + 1];
@@ -1403,7 +1405,8 @@
HWND hwnd = CreateWindow(TOOLBARCLASSNAME, NULL, WS_CHILD |
WS_VISIBLE | WS_BORDER | WS_CLIPSIBLINGS,
- 0, 0, w->width, w->toolbuttondimension + 12, w->main,
+ 0, 0, w->width,
+ w->toolbuttondimension + 12, w->main,
(HMENU) NSWS_ID_TOOLBAR, hinstance, NULL);
HIMAGELIST hImageList = ImageList_Create(w->toolbuttondimension - 8,
w->toolbuttondimension - 8, 0, w->ntoolbuttons, 0);
@@ -1490,7 +1493,7 @@
void nsws_window_throbber_create(struct gui_window *w)
{
HWND hwnd = Animate_Create(w->main, NSWS_ID_THROBBER,
- WS_CHILD | WS_VISIBLE | ACS_AUTOPLAY, hinstance);
+ WS_CHILD | WS_VISIBLE, hinstance);
SetWindowPos(hwnd, HWND_TOPMOST, w->width - NSWS_THROBBER_WIDTH, 4,
NSWS_THROBBER_WIDTH, NSWS_THROBBER_WIDTH,
SWP_SHOWWINDOW);
@@ -1503,7 +1506,10 @@
nsws_find_resource(avi, "throbber.avi", "windows/res/throbber.avi");
LOG(("setting throbber avi as %s", avi));
Animate_Open(hwnd, avi);
- Animate_Play(hwnd, 0, -1, -1);
+ if (w->throbbing)
+ Animate_Play(hwnd, 0, -1, -1);
+ else
+ Animate_Seek(hwnd, 0);
ShowWindow(hwnd, SW_SHOWNORMAL);
w->throbber = hwnd;
}
@@ -1922,6 +1928,8 @@
(WPARAM) NSWS_ID_NAV_RELOAD,
MAKELONG(TBSTATE_INDETERMINATE, 0));
}
+ w->throbbing = true;
+ Animate_Play(w->throbber, 0, -1, -1);
}
void gui_window_stop_throbber(struct gui_window *w)
@@ -1938,6 +1946,9 @@
(WPARAM) NSWS_ID_NAV_RELOAD,
MAKELONG(TBSTATE_ENABLED, 0));
}
+ w->throbbing = false;
+ Animate_Stop(w->throbber);
+ Animate_Seek(w->throbber, 0);
}
/**
13 years, 7 months
r9474 MarkieB - in /branches/MarkieB/windows/windows: gui.c res/throbber res/throbber.avi
by netsurf@semichrome.net
Author: MarkieB
Date: Thu Aug 27 12:10:29 2009
New Revision: 9474
URL: http://source.netsurf-browser.org?rev=9474&view=rev
Log:
preliminary throbber code
Added:
branches/MarkieB/windows/windows/res/throbber.avi (with props)
Removed:
branches/MarkieB/windows/windows/res/throbber
Modified:
branches/MarkieB/windows/windows/gui.c
Modified: branches/MarkieB/windows/windows/gui.c
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/gui.c?...
==============================================================================
--- branches/MarkieB/windows/windows/gui.c (original)
+++ branches/MarkieB/windows/windows/gui.c Thu Aug 27 12:10:29 2009
@@ -72,6 +72,7 @@
static int open_windows = 0;
#define NTOOLBUTTONS 5
+#define NSWS_THROBBER_WIDTH 32
#define NSWS_URL_ENTER (WM_USER)
struct gui_window {
@@ -81,6 +82,7 @@
HWND main; /**< handle to the actual window */
HWND toolbar; /**< toolbar handle */
HWND urlbar; /**< url bar handle */
+ HWND throbber; /** throbber handle */
HWND drawingarea; /**< drawing area handle */
HWND statusbar; /**< status bar handle */
HWND vscroll; /**< vertical scrollbar handle */
@@ -125,6 +127,10 @@
typedef enum {
NSWS_ID_TOOLBAR = 1111,
+ NSWS_ID_URLBAR,
+ NSWS_ID_THROBBER,
+ NSWS_ID_DRAWINGAREA,
+ NSWS_ID_STATUSBAR,
NSWS_ID_NAV_BACK,
NSWS_ID_NAV_FORWARD,
NSWS_ID_NAV_HOME,
@@ -132,9 +138,6 @@
NSWS_ID_NAV_RELOAD,
NSWS_ID_NAV_LOCALHISTORY,
NSWS_ID_NAV_GLOBALHISTORY,
- NSWS_ID_URLBAR,
- NSWS_ID_DRAWINGAREA,
- NSWS_ID_STATUSBAR,
NSWS_ID_FILE_QUIT,
NSWS_ID_FILE_OPEN_LOCATION,
NSWS_ID_FILE_OPEN_WINDOW,
@@ -182,6 +185,7 @@
static void nsws_window_set_ico(struct gui_window *);
static void nsws_window_toolbar_create(struct gui_window *);
static void nsws_window_urlbar_create(struct gui_window *);
+static void nsws_window_throbber_create(struct gui_window *);
static void nsws_window_statusbar_create(struct gui_window *);
static void nsws_window_drawingarea_create(struct gui_window *);
static void nsws_window_vscroll_create(struct gui_window *);
@@ -392,7 +396,7 @@
w->ntoolbuttons = NTOOLBUTTONS;
w->toolbuttondimension = 32; /* includes padding of 4 every side */
w->urlbarwidth = w->width - w->toolbuttondimension * w->ntoolbuttons
- - 8;
+ - 8 - NSWS_THROBBER_WIDTH;
w->requestscrollx = 0;
w->requestscrolly = 0;
@@ -639,11 +643,6 @@
(x + w->scrollx) / w->bw->scale,
(y - w->voffset + w->scrolly) /
w->bw->scale);
- else
- if (x < w->urlbarwidth) {
- SendMessage(w->urlbar, EM_SETSEL, (WPARAM) 0,
- (LPARAM) 10);
- }
return DefWindowProc(hwnd, msg, wparam, lparam);
break;
}
@@ -1091,7 +1090,8 @@
}
ReleaseDC(hwnd, hdc);
w->urlbarwidth = w->width - w->ntoolbuttons *
- w->toolbuttondimension - 8;
+ w->toolbuttondimension - 8 -
+ NSWS_THROBBER_WIDTH;
if (w->bw) {
browser_window_reformat(
w->bw, w->width, w->height);
@@ -1446,6 +1446,7 @@
w->toolbar = hwnd;
DeleteObject(hImageList);
nsws_window_urlbar_create(w);
+ nsws_window_throbber_create(w);
SendMessage(hwnd, WM_SIZE, 0,
MAKELONG(w->width, w->toolbuttondimension + 12));
toolproc = (FARPROC) SetWindowLong(hwnd, GWL_WNDPROC, (DWORD)
@@ -1481,6 +1482,30 @@
urlproc = (FARPROC) SetWindowLong(hwnd, GWL_WNDPROC, (DWORD)
nsws_window_url_callback);
w->urlbar = hwnd;
+}
+
+/**
+ * creation of throbber
+ */
+void nsws_window_throbber_create(struct gui_window *w)
+{
+ HWND hwnd = Animate_Create(w->main, NSWS_ID_THROBBER,
+ WS_CHILD | WS_VISIBLE | ACS_AUTOPLAY, hinstance);
+ SetWindowPos(hwnd, HWND_TOPMOST, w->width - NSWS_THROBBER_WIDTH, 4,
+ NSWS_THROBBER_WIDTH, NSWS_THROBBER_WIDTH,
+ SWP_SHOWWINDOW);
+
+ /* CreateWindow(ANIMATE_CLASS, "", WS_CHILD | WS_VISIBLE |
+ ACS_AUTOPLAY, w->width - NSWS_THROBBER_WIDTH, 4,
+ NSWS_THROBBER_WIDTH, NSWS_THROBBER_WIDTH, w->main,
+ (HMENU) NSWS_ID_THROBBER, hinstance, NULL); */
+ char avi[PATH_MAX];
+ nsws_find_resource(avi, "throbber.avi", "windows/res/throbber.avi");
+ LOG(("setting throbber avi as %s", avi));
+ Animate_Open(hwnd, avi);
+ Animate_Play(hwnd, 0, -1, -1);
+ ShowWindow(hwnd, SW_SHOWNORMAL);
+ w->throbber = hwnd;
}
/**
Removed: branches/MarkieB/windows/windows/res/throbber
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/res/th...
==============================================================================
--- branches/MarkieB/windows/windows/res/throbber (original)
+++ branches/MarkieB/windows/windows/res/throbber (removed)
@@ -1,1 +1,0 @@
-link ../../gtk/res/throbber
Added: branches/MarkieB/windows/windows/res/throbber.avi
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/res/th...
==============================================================================
Binary file - no diff available.
Propchange: branches/MarkieB/windows/windows/res/throbber.avi
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
13 years, 7 months
r9473 MarkieB - /branches/MarkieB/windows/windows/gui.c
by netsurf@semichrome.net
Author: MarkieB
Date: Thu Aug 27 10:36:11 2009
New Revision: 9473
URL: http://source.netsurf-browser.org?rev=9473&view=rev
Log:
swap locations of buttons <-> url bar
Modified:
branches/MarkieB/windows/windows/gui.c
Modified: branches/MarkieB/windows/windows/gui.c
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/gui.c?...
==============================================================================
--- branches/MarkieB/windows/windows/gui.c (original)
+++ branches/MarkieB/windows/windows/gui.c Thu Aug 27 10:36:11 2009
@@ -428,12 +428,14 @@
LRESULT CALLBACK nsws_window_url_callback(HWND hwnd, UINT msg, WPARAM wparam,
LPARAM lparam)
{
- if ((msg == WM_LBUTTONDOWN) || (msg == WM_LBUTTONUP) ||
- (msg == WM_MOUSEMOVE)) {
- int x,y;
- x = GET_X_LPARAM(lparam);
- y = GET_Y_LPARAM(lparam);
- SendMessage(hwnd, EM_SETSEL, (WPARAM) 0, (LPARAM) - 1);
+ DWORD i, ii;
+ SendMessage(hwnd, EM_GETSEL, (WPARAM)&i, (LPARAM)&ii);
+ int x,y;
+ x = GET_X_LPARAM(lparam);
+ y = GET_Y_LPARAM(lparam);
+ if (msg == WM_PAINT) {
+ SendMessage(hwnd, EM_SETSEL, (WPARAM)0, (LPARAM)-1);
+ SendMessage(hwnd, EM_SETSEL, (WPARAM)i, (LPARAM)ii);
}
return CallWindowProc((WNDPROC) urlproc, hwnd, msg, wparam, lparam);
}
@@ -469,12 +471,15 @@
int x,y;
x = GET_X_LPARAM(lparam);
y = GET_Y_LPARAM(lparam);
- if ((x < w->urlbarwidth) && (y < w->voffset)) {
+ if ((x > w->ntoolbuttons * w->toolbuttondimension) &&
+ (y < w->voffset)) {
if (msg == WM_LBUTTONDOWN)
SetFocus(w->urlbar);
return CallWindowProc((WNDPROC)
nsws_window_url_callback,
- w->urlbar, msg, wparam, lparam);
+ w->urlbar, msg, wparam,
+ MAKELONG(x - w->ntoolbuttons *
+ w->toolbuttondimension, y));
}
}
return CallWindowProc((WNDPROC) toolproc, hwnd, msg, wparam, lparam);
@@ -1406,9 +1411,9 @@
ZeroMemory(w->buttons, sizeof(w->buttons));
- w->buttons[0].iBitmap = w->urlbarwidth;
- w->buttons[0].fsStyle = TBSTYLE_SEP;
- w->buttons[0].iString = -1;
+ w->buttons[5].iBitmap = w->urlbarwidth;
+ w->buttons[5].fsStyle = TBSTYLE_SEP;
+ w->buttons[5].iString = -1;
/* w->buttons[0].fsState = TBSTATE_ENABLED; */
/* keep bitmaps in cache memory for re-creation of toolbar */
@@ -1424,10 +1429,10 @@
LR_LOADFROMFILE | LR_LOADTRANSPARENT);\
}\
ImageList_Add(hImageList, w->hbmp[p], NULL);\
- w->buttons[p + 1].iBitmap = MAKELONG(p, 0);\
- w->buttons[p + 1].idCommand = NSWS_ID_NAV_##q;\
- w->buttons[p + 1].fsState = TBSTATE_ENABLED;\
- w->buttons[p + 1].fsStyle = TBSTYLE_BUTTON
+ w->buttons[p].iBitmap = MAKELONG(p, 0);\
+ w->buttons[p].idCommand = NSWS_ID_NAV_##q;\
+ w->buttons[p].fsState = TBSTATE_ENABLED;\
+ w->buttons[p].fsStyle = TBSTYLE_BUTTON
MAKE_BUTTON(0, BACK, back);
MAKE_BUTTON(1, FORWARD, forward);
MAKE_BUTTON(2, HOME, home);
@@ -1454,9 +1459,9 @@
{
HWND hwnd = CreateWindow("EDIT", "", WS_CHILD | WS_VISIBLE |
ES_AUTOHSCROLL | ES_OEMCONVERT,
- 4, 6, w->urlbarwidth - 8,
- w->toolbuttondimension - 12, w->main,
- (HMENU) NSWS_ID_URLBAR, hinstance, NULL);
+ w->toolbuttondimension * w->ntoolbuttons + 4, 6,
+ w->urlbarwidth - 8, w->toolbuttondimension - 12,
+ w->main, (HMENU) NSWS_ID_URLBAR, hinstance, NULL);
HFONT font = CreateFont(14, /* height */
7, /* width */
0, /* escapement*/
13 years, 7 months
r9472 MarkieB - in /branches/MarkieB/windows/windows: prefs.c schedule.c
by netsurf@semichrome.net
Author: MarkieB
Date: Thu Aug 27 09:37:13 2009
New Revision: 9472
URL: http://source.netsurf-browser.org?rev=9472&view=rev
Log:
code tidying
Modified:
branches/MarkieB/windows/windows/prefs.c
branches/MarkieB/windows/windows/schedule.c
Modified: branches/MarkieB/windows/windows/prefs.c
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/prefs....
==============================================================================
--- branches/MarkieB/windows/windows/prefs.c (original)
+++ branches/MarkieB/windows/windows/prefs.c Thu Aug 27 09:37:13 2009
@@ -108,23 +108,14 @@
SendMessage(sub, CB_SETCURSEL,
(WPARAM) (option_font_default - 1), 0);
sub = GetDlgItem(hwnd, NSWS_ID_PREFS_ADVERTS);
- if (option_block_ads)
- SendMessage(sub, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
- else
- SendMessage(sub, BM_SETCHECK, (WPARAM)BST_UNCHECKED,
- 0);
+ SendMessage(sub, BM_SETCHECK, (WPARAM) ((option_block_ads) ?
+ BST_CHECKED : BST_UNCHECKED), 0);
sub = GetDlgItem(hwnd, NSWS_ID_PREFS_REFERER);
- if (option_send_referer)
- SendMessage(sub, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
- else
- SendMessage(sub, BM_SETCHECK, (WPARAM)BST_UNCHECKED,
- 0);
+ SendMessage(sub, BM_SETCHECK, (WPARAM)((option_send_referer) ?
+ BST_CHECKED : BST_UNCHECKED), 0);
sub = GetDlgItem(hwnd, NSWS_ID_PREFS_NOANIMATION);
- if (option_animate_images)
- SendMessage(sub, BM_SETCHECK, (WPARAM)BST_UNCHECKED,
- 0);
- else
- SendMessage(sub, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
+ SendMessage(sub, BM_SETCHECK, (WPARAM)((option_animate_images)
+ ? BST_UNCHECKED : BST_CHECKED), 0);
sub = GetDlgItem(hwnd, NSWS_ID_PREFS_FETCHERS);
snprintf(number, 6, "%d", option_max_fetchers);
SendMessage(sub, WM_SETTEXT, 0, (LPARAM)number);
Modified: branches/MarkieB/windows/windows/schedule.c
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/schedu...
==============================================================================
--- branches/MarkieB/windows/windows/schedule.c (original)
+++ branches/MarkieB/windows/windows/schedule.c Thu Aug 27 09:37:13 2009
@@ -24,20 +24,6 @@
#include "windows/windows.h"
#include "utils/log.h"
-
-#ifndef timeradd
-#define timeradd(a, aa, result)\
- do {\
- (result)->tv_sec = (a)->tv_sec + (aa)->tv_sec;\
- (result)->tv_usec = (a)->tv_usec + (aa)->tv_usec;\
- if ((result)->tv_usec >= 1000000)\
- {\
- ++(result)->tv_sec;\
- (result)->tv_usec -= 1000000;\
- }\
- } while (0)
-#endif
-
/* linked list of scheduled callbacks */
static struct nscallback *schedule_list = NULL;
13 years, 7 months
r9471 MarkieB - in /branches/MarkieB/windows/windows: gui.c prefs.c res/resource.o res/resource.rc schedule.c thumbnail.c windows.h
by netsurf@semichrome.net
Author: MarkieB
Date: Thu Aug 27 09:17:25 2009
New Revision: 9471
URL: http://source.netsurf-browser.org?rev=9471&view=rev
Log:
working animations
Modified:
branches/MarkieB/windows/windows/gui.c
branches/MarkieB/windows/windows/prefs.c
branches/MarkieB/windows/windows/res/resource.o
branches/MarkieB/windows/windows/res/resource.rc
branches/MarkieB/windows/windows/schedule.c
branches/MarkieB/windows/windows/thumbnail.c
branches/MarkieB/windows/windows/windows.h
Modified: branches/MarkieB/windows/windows/gui.c
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/gui.c?...
==============================================================================
--- branches/MarkieB/windows/windows/gui.c (original)
+++ branches/MarkieB/windows/windows/gui.c Thu Aug 27 09:17:25 2009
@@ -334,7 +334,7 @@
if (doublebuffering)
/* blit buffer to screen */
BitBlt(hdc, 0, w->voffset, w->width, w->height,
- bufferdc, 0, w->voffset,
+ w->bufferdc, 0, w->voffset,
SRCCOPY);
ReleaseDC(w->main, hdc);
doublebuffering = false;
@@ -1047,9 +1047,6 @@
w->redraw.top = MAX(ps.rcPaint.top - w->voffset, 0);
w->redraw.right = MIN(ps.rcPaint.right, w->width);
w->redraw.bottom = MIN(ps.rcPaint.bottom, w->height);
- printf("paint %ld,%ld to %ld,%ld\n", w->redraw.left,
- w->redraw.top, w->redraw.right,
- w->redraw.bottom);
redraw();
EndPaint(hwnd, &ps);
return DefWindowProc(hwnd, msg, wparam, lparam);
Modified: branches/MarkieB/windows/windows/prefs.c
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/prefs....
==============================================================================
--- branches/MarkieB/windows/windows/prefs.c (original)
+++ branches/MarkieB/windows/windows/prefs.c Thu Aug 27 09:17:25 2009
@@ -30,6 +30,13 @@
#define NSWS_PREFS_WINDOW_WIDTH 600
#define NSWS_PREFS_WINDOW_HEIGHT 400
+#ifndef MIN
+#define MIN(a,b) (((a) < (b)) ? (a) : (b))
+#endif
+
+#ifndef MAX
+#define MAX(a,b) (((a) > (b)) ? (a) : (b))
+#endif
/* static HWND prefswindow = NULL; */
void nsws_prefs_window_create(HWND parent);
@@ -100,11 +107,24 @@
SendMessage(sub, CB_ADDSTRING, 0, (LPARAM)"Fantasy");
SendMessage(sub, CB_SETCURSEL,
(WPARAM) (option_font_default - 1), 0);
- if ((option_block_ads) && (IsDlgButtonChecked(hwnd,
- NSWS_ID_PREFS_ADVERTS) == BST_UNCHECKED)) {
- sub = GetDlgItem(hwnd, NSWS_ID_PREFS_ADVERTS);
+ sub = GetDlgItem(hwnd, NSWS_ID_PREFS_ADVERTS);
+ if (option_block_ads)
SendMessage(sub, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
- }
+ else
+ SendMessage(sub, BM_SETCHECK, (WPARAM)BST_UNCHECKED,
+ 0);
+ sub = GetDlgItem(hwnd, NSWS_ID_PREFS_REFERER);
+ if (option_send_referer)
+ SendMessage(sub, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
+ else
+ SendMessage(sub, BM_SETCHECK, (WPARAM)BST_UNCHECKED,
+ 0);
+ sub = GetDlgItem(hwnd, NSWS_ID_PREFS_NOANIMATION);
+ if (option_animate_images)
+ SendMessage(sub, BM_SETCHECK, (WPARAM)BST_UNCHECKED,
+ 0);
+ else
+ SendMessage(sub, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
sub = GetDlgItem(hwnd, NSWS_ID_PREFS_FETCHERS);
snprintf(number, 6, "%d", option_max_fetchers);
SendMessage(sub, WM_SETTEXT, 0, (LPARAM)number);
@@ -173,6 +193,12 @@
option_max_cached_fetch_handles);
SendMessage(sub, WM_SETTEXT, 0, (LPARAM)number);
}
+ if (option_minimum_gif_delay != 0) {
+ sub = GetDlgItem(hwnd, NSWS_ID_PREFS_ANIMATIONDELAY);
+ snprintf(number, 6, "%.1f", option_minimum_gif_delay /
+ 100.0);
+ SendMessage(sub, WM_SETTEXT, 0, (LPARAM)number);
+ }
return TRUE;
}
case WM_CREATE:
@@ -194,7 +220,14 @@
option_block_ads = (IsDlgButtonChecked(hwnd,
NSWS_ID_PREFS_ADVERTS) == BST_CHECKED)
? true : false;
-*/ sub = GetDlgItem(hwnd, NSWS_ID_PREFS_FETCHERS);
+*/
+ option_send_referer = (IsDlgButtonChecked(hwnd,
+ NSWS_ID_PREFS_REFERER) == BST_CHECKED)
+ ? true : false;
+ option_animate_images = (IsDlgButtonChecked(hwnd,
+ NSWS_ID_PREFS_NOANIMATION) ==
+ BST_CHECKED) ? false : true;
+ sub = GetDlgItem(hwnd, NSWS_ID_PREFS_FETCHERS);
len = SendMessage(sub, WM_GETTEXTLENGTH, 0, 0);
temp = malloc(len + 1);
if (temp != NULL) {
@@ -240,6 +273,16 @@
(len + 1), (LPARAM) temp);
option_font_min_size = (int)
(10 * strtod(temp, NULL));
+ free(temp);
+ }
+ sub = GetDlgItem(hwnd, NSWS_ID_PREFS_ANIMATIONDELAY);
+ len = SendMessage(sub, WM_GETTEXTLENGTH, 0, 0);
+ temp = malloc(len + 1);
+ if (temp != NULL) {
+ SendMessage(sub, WM_GETTEXT, (WPARAM)
+ (len + 1), (LPARAM) temp);
+ option_minimum_gif_delay = (int)
+ (100 * strtod(temp, NULL));
free(temp);
}
sub = GetDlgItem(hwnd, NSWS_ID_PREFS_PROXYHOST);
@@ -493,6 +536,7 @@
size = strtod(temp, NULL) - 0.1;
}
free(temp);
+ size = MAX(size, 0);
snprintf(number, 6, "%.1f", size);
SendMessage(sub, WM_SETTEXT, 0,
(LPARAM)number);
@@ -512,10 +556,34 @@
size = strtod(temp, NULL) + 0.1;
}
else if (ud->iDelta == -1) {
- size = strtod(temp, NULL) + 0.1;
+ size = strtod(temp, NULL) - 0.1;
}
free(temp);
+ size = MAX(size, 0);
snprintf(number, 6, "%.1f", size);
+ SendMessage(sub, WM_SETTEXT, 0,
+ (LPARAM)number);
+ return TRUE;
+ }
+ case NSWS_ID_PREFS_ANIMATIONDELAY_SPIN: {
+ double animation;
+ sub = GetDlgItem(hwnd,
+ NSWS_ID_PREFS_ANIMATIONDELAY);
+ len = SendMessage(sub, WM_GETTEXTLENGTH, 0, 0);
+ temp = malloc(len + 1);
+ if (temp == NULL)
+ return FALSE;
+ SendMessage(sub, WM_GETTEXT, (WPARAM)
+ (len + 1), (LPARAM) temp);
+ if (ud->iDelta == 1) {
+ animation = strtod(temp, NULL) + 0.1;
+ }
+ else if (ud->iDelta == -1) {
+ animation = strtod(temp, NULL) - 0.1;
+ }
+ free(temp);
+ animation = MAX(animation, 0);
+ snprintf(number, 6, "%.1f", animation);
SendMessage(sub, WM_SETTEXT, 0,
(LPARAM)number);
return TRUE;
Modified: branches/MarkieB/windows/windows/res/resource.o
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/res/re...
==============================================================================
Binary files - no diff available.
Modified: branches/MarkieB/windows/windows/res/resource.rc
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/res/re...
==============================================================================
--- branches/MarkieB/windows/windows/res/resource.rc (original)
+++ branches/MarkieB/windows/windows/res/resource.rc Thu Aug 27 09:17:25 2009
@@ -26,70 +26,77 @@
EDITTEXT NSWS_ID_PREFS_HOMEPAGE,70,10,300,12,ES_AUTOHSCROLL |
ES_OEMCONVERT
- CTEXT "Content",IDC_STATIC,6,45,45,10
- AUTOCHECKBOX "Hide Advertisements",NSWS_ID_PREFS_ADVERTS,52,45,90,10
- AUTOCHECKBOX "Disable Pop-ups",NSWS_ID_PREFS_POPUPS,145,45,80,10
- AUTOCHECKBOX "Disable Plugins",NSWS_ID_PREFS_PLUGINS,225,45,80,10
- AUTOCHECKBOX "Send referer",NSWS_ID_PREFS_REFERER,305,45,70,10
+ CTEXT "Content",IDC_STATIC,6,37,45,10
+ AUTOCHECKBOX "Hide Advertisements",NSWS_ID_PREFS_ADVERTS,52,37,90,10
+ AUTOCHECKBOX "Disable Pop-ups",NSWS_ID_PREFS_POPUPS,145,37,80,10
+ AUTOCHECKBOX "Disable Plugins",NSWS_ID_PREFS_PLUGINS,225,37,80,10
+ AUTOCHECKBOX "Send referer",NSWS_ID_PREFS_REFERER,305,37,70,10
- CTEXT "HTTP proxy",IDC_STATIC,6,76,40,10
- COMBOBOX NSWS_ID_PREFS_PROXYTYPE,47,75,45,60,CBS_DROPDOWNLIST
- CTEXT "Host",IDC_STATIC,93,76,25,10
- EDITTEXT NSWS_ID_PREFS_PROXYHOST,118,75,89,12,ES_AUTOHSCROLL |
+ CTEXT "HTTP proxy",IDC_STATIC,6,61,40,10
+ COMBOBOX NSWS_ID_PREFS_PROXYTYPE,47,60,45,60,CBS_DROPDOWNLIST
+ CTEXT "Host",IDC_STATIC,93,61,25,10
+ EDITTEXT NSWS_ID_PREFS_PROXYHOST,118,60,89,12,ES_AUTOHSCROLL |
ES_OEMCONVERT
- CTEXT ":",IDC_STATIC,207,76,4,10
- EDITTEXT NSWS_ID_PREFS_PROXYPORT,210,75,20,12,ES_AUTOHSCROLL |
+ CTEXT ":",IDC_STATIC,207,61,4,10
+ EDITTEXT NSWS_ID_PREFS_PROXYPORT,210,60,20,12,ES_AUTOHSCROLL |
ES_OEMCONVERT
- CTEXT "Username",IDC_STATIC,230,76,35,10
- EDITTEXT NSWS_ID_PREFS_PROXYNAME,265,75,45,12,ES_AUTOHSCROLL |
+ CTEXT "Username",IDC_STATIC,230,61,35,10
+ EDITTEXT NSWS_ID_PREFS_PROXYNAME,265,60,45,12,ES_AUTOHSCROLL |
ES_OEMCONVERT
- CTEXT "Password",IDC_STATIC,311,76,35,10
- EDITTEXT NSWS_ID_PREFS_PROXYPASS,346,75,45,12,ES_AUTOHSCROLL |
+ CTEXT "Password",IDC_STATIC,311,61,35,10
+ EDITTEXT NSWS_ID_PREFS_PROXYPASS,346,60,45,12,ES_AUTOHSCROLL |
ES_OEMCONVERT
- CTEXT "Fonts",IDC_STATIC,6,114,25,10
- CTEXT "Size",IDC_STATIC,36,114,20,10
- EDITTEXT NSWS_ID_PREFS_FONT_SIZE,56,111,20,15
+ CTEXT "Fonts",IDC_STATIC,6,93,25,10
+ CTEXT "Size",IDC_STATIC,36,93,20,10
+ EDITTEXT NSWS_ID_PREFS_FONT_SIZE,56,90,20,15
CONTROL "Font Size",NSWS_ID_PREFS_FONT_SIZE_SPIN,UPDOWN_CLASS,
- UDS_NOTHOUSANDS,76,111,10,15
+ UDS_NOTHOUSANDS,76,90,10,15
- CTEXT "Min Size",IDC_STATIC,90,114,28,10
- EDITTEXT NSWS_ID_PREFS_FONT_MINSIZE,118,111,20,15
+ CTEXT "Min Size",IDC_STATIC,90,93,28,10
+ EDITTEXT NSWS_ID_PREFS_FONT_MINSIZE,118,90,20,15
CONTROL "Font Size",NSWS_ID_PREFS_FONT_MINSIZE_SPIN,
- UPDOWN_CLASS,UDS_NOTHOUSANDS,138,111,10,15
+ UPDOWN_CLASS,UDS_NOTHOUSANDS,138,90,10,15
- CTEXT "Sans-serif:",IDC_STATIC,150,114,35,10
- PUSHBUTTON "Sans",NSWS_ID_PREFS_SANS,188,111,90,15
- CTEXT "Serif:",IDC_STATIC,280,114,30,10
- PUSHBUTTON "Serif",NSWS_ID_PREFS_SERIF,315,111,80,15
+ CTEXT "Sans-serif:",IDC_STATIC,150,93,35,10
+ PUSHBUTTON "Sans",NSWS_ID_PREFS_SANS,188,90,90,15
+ CTEXT "Serif:",IDC_STATIC,280,93,30,10
+ PUSHBUTTON "Serif",NSWS_ID_PREFS_SERIF,315,90,80,15
- CTEXT "Monospace:",IDC_STATIC,6,130,45,10
- PUSHBUTTON "Monospace",NSWS_ID_PREFS_MONO,56,127,92,15
- CTEXT "Cursive:",IDC_STATIC,150,130,35,10
- PUSHBUTTON "Cursive",NSWS_ID_PREFS_CURSIVE,188,127,90,15
- CTEXT "Fantasy:",IDC_STATIC,280,130,35,10
- PUSHBUTTON "Fantasy",NSWS_ID_PREFS_FANTASY,315,127,80,15
+ CTEXT "Monospace:",IDC_STATIC,6,111,45,10
+ PUSHBUTTON "Monospace",NSWS_ID_PREFS_MONO,56,108,92,15
+ CTEXT "Cursive:",IDC_STATIC,150,111,35,10
+ PUSHBUTTON "Cursive",NSWS_ID_PREFS_CURSIVE,188,108,90,15
+ CTEXT "Fantasy:",IDC_STATIC,280,111,35,10
+ PUSHBUTTON "Fantasy",NSWS_ID_PREFS_FANTASY,315,108,80,15
- CTEXT "Font default",IDC_STATIC,6,145,40,10
- COMBOBOX NSWS_ID_PREFS_FONTDEF,56,145,90,60,CBS_DROPDOWNLIST
+ CTEXT "Font default",IDC_STATIC,6,126,40,10
+ COMBOBOX NSWS_ID_PREFS_FONTDEF,56,126,90,60,CBS_DROPDOWNLIST
- CTEXT "Fetching",IDC_STATIC,6,190,45,10
- CTEXT "Max Fetchers",IDC_STATIC,50,190,50,10
- EDITTEXT NSWS_ID_PREFS_FETCHERS,100,188,25,15
+ CTEXT "Fetching",IDC_STATIC,6,161,45,10
+ CTEXT "Max Fetchers",IDC_STATIC,50,161,50,10
+ EDITTEXT NSWS_ID_PREFS_FETCHERS,100,159,25,15
CONTROL "Max Fetchers",NSWS_ID_PREFS_FETCHERS_SPIN,
UPDOWN_CLASS, UDS_AUTOBUDDY |
- UDS_SETBUDDYINT,125,188,10,15
+ UDS_SETBUDDYINT,125,159,10,15
- CTEXT "Fetches per host",IDC_STATIC,138,190,60,10
- EDITTEXT NSWS_ID_PREFS_FETCH_HOST,205,188,25,15
+ CTEXT "Fetches per host",IDC_STATIC,138,161,60,10
+ EDITTEXT NSWS_ID_PREFS_FETCH_HOST,205,159,25,15
CONTROL "Fetches per host",NSWS_ID_PREFS_FETCH_HOST_SPIN,
UPDOWN_CLASS, UDS_AUTOBUDDY |
- UDS_SETBUDDYINT,228,188,10,15
+ UDS_SETBUDDYINT,228,159,10,15
- CTEXT "cached Fetches",IDC_STATIC,245,190,60,10
- EDITTEXT NSWS_ID_PREFS_FETCH_HANDLES,305,188,25,15
+ CTEXT "cached Fetches",IDC_STATIC,245,161,60,10
+ EDITTEXT NSWS_ID_PREFS_FETCH_HANDLES,305,159,25,15
CONTROL "cached Fetches",NSWS_ID_PREFS_FETCH_HANDLES_SPIN,
UPDOWN_CLASS, UDS_AUTOBUDDY |
- UDS_SETBUDDYINT,330,188,10,15
+ UDS_SETBUDDYINT,330,159,10,15
+
+ CTEXT "Animation",IDC_STATIC,6,192,35,10
+ AUTOCHECKBOX "disable",NSWS_ID_PREFS_NOANIMATION,60,192,45,10
+ CTEXT "Min delay",IDC_STATIC,111,192,45,10
+ EDITTEXT NSWS_ID_PREFS_ANIMATIONDELAY,150,189,20,15
+ CONTROL "Min delay",NSWS_ID_PREFS_ANIMATIONDELAY_SPIN,
+ UPDOWN_CLASS,UDS_NOTHOUSANDS,170,189,10,15
END
Modified: branches/MarkieB/windows/windows/schedule.c
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/schedu...
==============================================================================
--- branches/MarkieB/windows/windows/schedule.c (original)
+++ branches/MarkieB/windows/windows/schedule.c Thu Aug 27 09:17:25 2009
@@ -25,6 +25,20 @@
#include "utils/log.h"
+#ifndef timeradd
+#define timeradd(a, aa, result)\
+ do {\
+ (result)->tv_sec = (a)->tv_sec + (aa)->tv_sec;\
+ (result)->tv_usec = (a)->tv_usec + (aa)->tv_usec;\
+ if ((result)->tv_usec >= 1000000)\
+ {\
+ ++(result)->tv_sec;\
+ (result)->tv_usec -= 1000000;\
+ }\
+ } while (0)
+#endif
+
+
/* linked list of scheduled callbacks */
static struct nscallback *schedule_list = NULL;
@@ -64,7 +78,7 @@
LOG(("adding callback %p for %p(%p) at %d cs", nscb, callback, p, cs_ival));
gettimeofday(&nscb->tv, NULL);
-/* timeradd(&nscb->tv, &tv, &nscb->tv); */
+ timeradd(&nscb->tv, &tv, &nscb->tv);
nscb->callback = callback;
nscb->p = p;
Modified: branches/MarkieB/windows/windows/thumbnail.c
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/thumbn...
==============================================================================
--- branches/MarkieB/windows/windows/thumbnail.c (original)
+++ branches/MarkieB/windows/windows/thumbnail.c Thu Aug 27 09:17:25 2009
@@ -81,7 +81,6 @@
}
SelectObject(bufferdc, bufferbm);
thumbnail = true;
- plot.rectangle(0, 0, width, height, plot_style_fill_white);
content_redraw(content, 0, 0, content->width, content->height, 0, 0,
width, height, 1.0, 0xFFFFFF);
thumbnail = false;
Modified: branches/MarkieB/windows/windows/windows.h
URL: http://source.netsurf-browser.org/branches/MarkieB/windows/windows/window...
==============================================================================
--- branches/MarkieB/windows/windows/windows.h (original)
+++ branches/MarkieB/windows/windows/windows.h Thu Aug 27 09:17:25 2009
@@ -51,12 +51,21 @@
#define NSWS_ID_PREFS_FETCH_HOST_SPIN 11137
#define NSWS_ID_PREFS_FETCH_HANDLES 11138
#define NSWS_ID_PREFS_FETCH_HANDLES_SPIN 11139
+#define NSWS_ID_PREFS_NOANIMATION 11140
+#define NSWS_ID_PREFS_ANIMATIONDELAY 11141
+#define NSWS_ID_PREFS_ANIMATIONDELAY_SPIN 11142
-/* typedef enum {
- NSWS_ID_ABOUT_DIALOG = 11111,
- NSWS_ID_PREFS_DIALOG,
- NSWS_ID_ABOUT_CONTENT
-} nsws_constants_ids;
-*/
+#ifndef timeradd
+#define timeradd(a, aa, result)\
+ do {\
+ (result)->tv_sec = (a)->tv_sec + (aa)->tv_sec;\
+ (result)->tv_usec = (a)->tv_usec + (aa)->tv_usec;\
+ if ((result)->tv_usec >= 1000000)\
+ {\
+ ++(result)->tv_sec;\
+ (result)->tv_usec -= 1000000;\
+ }\
+ } while (0)
+#endif
#endif
13 years, 7 months